I have spring MVC web app, That is run on web browser. But now I want to use this application as standalone software. So any trick to convert this spring MVC application from web application to standalone software.
Electron window server allows you to host external site. You can create a standalone software that points to your Spring MVC web URL from electron windows server. Alternatively, you can also separate your front and back end code as electron bundles html/js in desktop application. Your front end will then communicate with your backend via REST APIs.
As I understand, there is no qucker way . You have to convert mvc configuration to standalone web application step by step.
Mvc rest mapping can be converted to REST api using library like Resteasy. Veiw mapping from spring MVC can be done through web.xml of standalone application.
It will helpful, if you provide more details regarding exactly what you want to achieve.
Related
I want a barebone template project for a webapp implemented using spring boot (frontend + backend APIs - DB)
I referred this VS Code's doc for working with Java. It worked fine but it is not a complete webapp.
Thanks in advance!
Vaadin Flow is a GUI framework for web apps driven through Spring Boot. (Alternatively, you can base your Vaadin app on Jakarta EE or plain Jakarta Servlet.)
A customized project template can be generated from their "Start building" web page.
You can manage your Vaadin project with either Maven or Gradle.
If you want to generate an app with spring boot + angular/reactjs/vuejs I think that the best solution by far at this moment is JHipster.
I want to create a Spring MVC rest application for web browser, android and ios
For web browser, I am using angular2 and my web server is apache tomcat.
So I am confused that I need to put the angular code inside my Spring mvc appllication project directory or create a separate instance for angular.If I have to create separate instance for both then how I will deploy angular code to the tomcat server.
You can do the both.
If you want to put the angular2 files to the tomcat then look here. This is might not straight forward.
If you want to deploy separately, I mean server(spring REST) and client(angular2) then angular2 app can deploy using the ng command or any web server like apache, nginx. You can look here for example
You can do that in any of the ways.
But
with a SPA + REST technology stack, I prefer separating front end and
back end with rest api because static resources are best served from front-server. Since Front-End servers (e.g. nginx,apache2) are very powerful and since you can use Cache for static resources, you can manage with a single deployment of your static resources (which should be all HTML content, JS, CSS, Images).
I have a Spring web application and an standalone application written on C#. Only Spring application has an access to DB, so I want to implement data exchange between Java and C#. The data isn't large (100KB / Min or so). Application will be placed on the same machine. What is the best way to integrate a communication? Does Spring Framework has a module to work with?
Spring certainly does have a module for doing this, it's called Spring Integration. You can define inbound and outbound channels/gateways and before the data comes in or out do any transformation on it needed to get it in the right format. Pretty standard functionality for doing enterprise integration.
Alternatively if that's too heavy weight you could expose a RESTful webservice in the spring application using the #RestController annotation and call that api from C# application. Another alternative would be to expose a spring-ws Web service in the spring application and write a Soap client that calls it in the C# application.
I have written a SOAP based web service which runs fine on a Tomcat server. The Web Service service itself is a Spring MVC based web service that runs on the Tomcat application server.
Now i need to write a Thick client which will be a standalone Java app that will use the services of the web service. I think i am correct in that the client only needs to know about the service details (i.e. operations) and nothing else.
What i am not sure of is the architecture and environment i should use for the client. The client application will be based on Swing but is it possible to use Spring with Swing together?
On the web service i have the following setup
view --> Service --> Model
The client application is basically a configuration tool. It uses the web service to configure user accounts. This means that the client application does not actually write anything to any database. It just uses the services of the web service to make changes to 'user account' and probably view list of accounts.
My question really is
- Is an MVC design suitable for such a use case
- Usually Spring is used for web based applications. Is there any benefit in using Spring with the Swing based client?
- Are there any alternative or better solutions/design/architecture that would achieve the same?
An example showing Spring used in conjunction with a Swing application would be very usefull.
Thanks in advance.
Spring MVC is not appropriate for a Swing-based client. Use the core Spring framework and a JAX-RS implementation like Jersey to provide simple REST web services in tomcat. Jersey also provides a corresponding client API that you can use within your Swing application to invoke the REST services.
If you have decided upon Swing as your platform, there are two options you can look at:
(1) Net Beans Rich Client Platform
http://netbeans.org/kb/trails/platform.html
(2) You can roll up your sleeves and write your own app using a low level yet extremely flexible framework called Swixml
http://www.swixml.org/
Give Swixml a good try before you try others, it may surprise you.
You can implement Swing-based thin client application with Spring Integration backend serving as a integration tier. It can expose gateways accepting simple Java types or DTOs. Your Swing presenters / controllers interacts with these components in order to call remote webservices.
We have the following architecture in mind:
To an existing application, we would like to add a web service front end.
The web service will be used from a web portal, which runs on a different web server.
So, we will not use a database on this different web server and just forward entries from the web portal to the web service and show what the web service returns.
First question: what do you think about this architecture?
Second question: Can you recommend a java framework for this web server?
On the second question: one possibility is to use WSRP with Java Portlets.