I know by default Spring boot produces a fat Jar file which incorporates an embedded server but when it comes down to security is there any flaws using an embedded server compare to launching your spring application to an existing server like tomcat. Is the jar or war more secure ?
Tried looking it up but I’ve seen a post explaining some pros and cons to using an embedded server vs an existing application server but I lost that post I need more insight please help. I know using embedded is quick and less work on configuration but is it more secure to deploying to an existing tomcat server or jboss instead of using spring default embedded server please help me so I don’t make mistakes when making a large app
Related
I'm trying to bundle ReactJS and Spring Boot API together and build one fat jar. In every tutorial I read, I'm told to put the localhost API URL as a proxy in package.json of the React app like below.
"proxy": "http://localhost:8080"
As I obviously don't have PROD deployment experience with this, is this the way to go when you are deploying in PROD? Else, please guide me in the right direction. I couldn't find the answer anywhere.
Also, any cons in doing so in a medium sized project with two developers? Appreciate any input.
The "proxy" field should only be used in development environment when the Webpack dev server is first in line(to enable the Hot-Reload feature)
Here is a guide from 2018:
spring + react guide
regardless there are two main way of hosting the react app:
inside the spring boot Jar a static resource(you can use frontend-maven-plugin to run yarn/ npm again see the guide),
the advantages of this method is security, you don't need CORS enabled to serve the page.
the disadvantages is convenient this solution require more code, also the spring boot server handles UI serving to the client that requires extra calls to the server(spring first approach)
the other option is to host it in a hosting service like amazon S3 and then it will be hosted not in spring but in s3 and will be the first in line(UI first approach), you will need to enable CORS in spring boot app, but this is a more continent solution.
ps. I would read some guides first, it would help you with general understanding
My application has two separate parts, back-end in Java (Spring boot) and front-end in Vuejs.
I can simply deploy the JAR for my back-end code where I need to, and that's it for deployment.
But when it comes to deploying the Vuejs app, I can do something similar and just put the compiled Vuejs application in the proper path in a Java Spring boot application and that will be all for the front-end too.
It just doesn't seem right to me to put that application in Spring boot when it doesn't really have to do anything with it really other than for deployment (Maybe I know nothing like Jon Snow).
Also, when its put under a Spring boot application, manual URL editing doesn't work.
This app doesn't do anything on its own, it fetches all its data from the back-end app.
So what are my options here, can someone please guide me in the right direction?
Do I just setup a nodejs server and deploy the Vuejs app in that? I am not sure how that works, or whether should I even be doing that for a production application. And if so, where do I start with setting up nodejs?
It makes sense to deploy it together with spring, and it's very common practice, at least from my experience with Angular (which I suppose would be very similar to VueJS).
You don't need to have 2 servers running. You just let Spring server your HTML/js/CSS files, which helps you avoid any problems with CORS.
I am not really sure what 'URL manual editing', do you mean by navigating the web page by editing the URL? I don't see much use cases there tbh and I would guess that is only a matter of few settings.
In gradle - I would set up a build task (not sure if task is correct word, 2 build.gradle files, each for FE/BE, the BE would depend on FE), the FE would be run when BE is run, it creates static HTML/js (in my case from angular, but it should be similar for Vue) and BE task adds the output to the classpath of the java application so that Spring can register the HTML and serve it to you.
You could use Docker to create a Dockerized version of your Vue.js app and then you can deploy this onto a cloud service provider such as AWS (e.g. EC2).
Check out this link for a basic guide https://v2.vuejs.org/v2/cookbook/dockerize-vuejs-app.html
My approach is to deploy front-end and back-end separately.
You can use web-server to proxy requests to Vuejs or Spring boot.
For example, if you use Nginx, you can use this configuration to pass requests
# pass root request to index file
location / {
root /front_files/;
index /index.html;
}
# pass requests to static files
location ~ ^/(js|styles) {
root /front_files/;
}
# pass requests to back-end
location /api/ {
proxy_pass http://127.0.0.1:8080/;
}
I know this question might sound stupid but for me it's new. I have developed a simple Spring Boot Application, provide some backend APIs, running on localhost. I have also bought an webhosting server with my own domain, let's say: www.my-domain.com. Right now in the my-domain.com I just have some simple html code. And what I want to do is having the spring boot application running also under this domain.
Is it possible then? If yes can anyone point me to some references please?. If no, what do I need to run an Java Application under my own domain?
Thank you very much!
You need to run the Spring boot application on the server, then you need to configure your web server (nginx/apache), configure Spring API path and port on the web server, and the traffic will go into your application.
I have just learned to create java rest API using jersey and Oracle database.
I'm developing in eclipse and using weblogic server to run and test web service on localhost.
My question is what are the options of live servers to deploy this service so that I can access this API in my android application or any web application???
You can do that. But you have to make sure that all the dependent jars are packaged with the your WAR project(eg; Oracle db related things).
Some blog entries which give you an idea about what are all these servers and which one to pick for open development and common standards - http://blogs.forrester.com/mike_gualtieri/11-07-15-stop_wasting_money_on_weblogic_websphere_and_jboss_application_servers,
and this one http://zeroturnaround.com/rebellabs/the-great-java-application-server-debate-with-tomcat-jboss-glassfish-jetty-and-liberty-profile/
This will give pretty good idea about what is all these servers :)
I am having a web application which is deployed in oracle weblogic application server. After getting analysed, i found that there is no need for application server(atleast for this application), i am in need to deploy this application into the oracle weblogic web server.
can anyone help on this, how can i change deployed application to webserver from application server ?
Or in a different words, i can say how can i migrate my application deployment from oracle weblogic application server to oracle weblogic web server ?
I am using weblogic 10. and Maven to build the application
About the application, it is using Apache axis, webservices, jsf, and few java classes.
Thanks in advance!
I've recently migrated one application from WAS to tomcat
The approach i followd is.
Identify and remove all the WL specific dependencies / jars (that you may not need of)
Change the build script to generate .war instead of .ear
deploy the generated .war to any servlet container/ webserver
with your specs (axis,ws,jsf) you dont need a .ear but .war will do.
if you are using ant modify your build script, i'd suggest go for maven for better dependency management
building of top of the answer by #TechExchange
even for Jboss, you still need to analyze the application to remove all WL specifics.
Ex: Descriptors for EJB's MDB's and so on.
with JBOSS you can still use the ear format.
A quesiton, you had mentioned that because you found that the application doesn't need a app server you decided to migrate it to web server, now with JMS in the picture do you still need to move?