How to deploy the Spring boot with angular2 code in heroku - java

How to deploy the Spring boot with angular2 code in heroku.. i have front end and back end code in different folder

I don't understand your problem)
If you want to deploy front and back ends together to Tomcat (for example), you should just create static folder in resources and transfer to it all your js code.

Related

How to Reduce Build Time with Angular 2 within Java EE Spring Boot Web App

I am building an angular 2 java EE spring boot web application within eclipse neon. For development reasons, I wanted to simply keep my angular files within my java project, but this is looking like a bad idea, since the node_modules folder for the angular 2 source is the meat of the angular source (over 150 MB), it is causing my project to build and run extremely slowly.
What is the best way to keep my angular files outside of my java project and connect to it via spring boot and java? What is the preferred method? Thanks!
I faced this problem while ago. i solved like this
create your spring boot in STS or Eclipse
write your Angular app in VS code IDE ( its awesome )
To use consume REST service created by Spring Project in Angular use proxy.conf.json.
{
“/spirngapi” :{
“target” : “http://localhost:8080”,
“secure” : false
}
}
this will redirect Angular http calls to your spring application file.
For production you can generate production build in Angular and Copy file in to war file.

How to build web.xml for Dropwizard application

I have created application in Dropwizard, which is serving REST API to my clients. I used to run this from .jar file on server, everything worked fine.
Now I have requirement to move my application to WildFly, so now I assume that I need to have a WAR instead of JAR, and here comes my problem:
How to write web.xml to my application? What to include in there? Could anyone give me any template or tutorial or some example how it is done in Dropwizard?
I found what I was looking for. It's wizard-in-a-box project that do all the necessary things to build a WAR file.

Spring Boot - Proper location for html files

I am new to Spring Boot and I am trying to add a simple html page for my project
At the moment, my project's structure is the following:
Having read the following:
https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot
http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-developing-web-applications.html#boot-features-spring-mvc-static-content
and other answers in StackOverflow, I'd expect to see the contents of index.html when I visit http://localhost:8080/
What could I be missing?
As there is no webapp in SpringBoot project , we can place the html files in either in
src/main/resources/resources/index.html
src/main/resources/static/index.html
src/main/resources/public/index.html
Remember the above is in highest to lowest precedence.
To check your file run the main class in eclipse and go to http://localhost:8080/index.html
First of all the correct way to serve files in Spring Boot is described in
cannot find html pages with spring boot
After adding the directories required, I tried /services/login.html where "services" is the mapping for my Dispatcher servlet.
So what happens here is that Spring Boot will only answer to requests sent to /services/* even if these requests are pointing to something other than a controller.
I guess that this makes sense in the world of Spring Boot but when I tried in the same in a Spring MVC project (no Spring Boot) I was able to access simple html files that I had simply added into my WEB-INF directory

Spring boot web app load new web pages created by another application

I have a webapp that runs with Spring Boot.
It exposes a REST API and some static web pages with AngularJS.
My problem is that I have another application that creates dynamically some other static web pages in the same location of the first web pages but with subfolders.
It works well but when I want to access them throught my browser, the pages aren't displayed...
To illustrate, here is the structure at the begining:
webapp
index.html
And then:
webapp
index.html
directory
directory2
myPage.html
How to do tell Tomcat It has to refresh its structure?
I think this is a very strange project structure. you have several possibilities, the first one of them is to store generated pages not in tomcat webapp but outside of tomcat, somewhere in the filesystem where tomcat has access.
Other variant is to store all needed resources in database.
The last is to use tomcat hot relaod.

Deploying Java Spring Rest Service To Tomcat 6.0.20

I'm fairly new with Spring Framework and struggling to get this simple example to work on a Tomcat 6 instance. The example is here http://spring.io/guides/gs/rest-service/ .
It works fine when i run it within Eclipse but when i convert it to a WAR file and deploy, the directory in Tomcat is created but the service/tomcat responds with a 404.
I suspect i need to create a web.xml file (not sure the annotated way will work with tomcat 6 because it supports only servlet 2.5) but not sure where to start.
Any help would be much appreciated.

Categories

Resources