Hey everyone! I’m having trouble getting my Spring Boot and Angular 6 app to play nice on Apache Tomcat 8. The code works great on my local machine, but I’m lost when it comes to deployment.
I’ve got the dist folder from Angular and the WAR file from Spring Boot. I put them both on the server, but now I’m stuck. When I try to access the login page, it shows up, but there’s no connection to the backend.
Can anyone walk me through how to properly deploy these two parts so they can talk to each other? I’m not sure if I need to change any config files or if I’m missing a step somewhere.
I’d really appreciate some guidance on this. Thanks in advance for any help!
hey there! have u considered using a reverse proxy setup? it might solve ur communication issues. what if u deployed the spring boot app separately and used apache to forward requests? curious to hear if youve tried that approach. how’s ur experience with configuring apache so far?
Setting up your Spring Boot backend and Angular 6 frontend on Tomcat 8 can require careful configuration to ensure both parts communicate properly.
One way to approach this is to build your Angular app with the --base-href option set to the context path you intend to use in Tomcat. For the Spring Boot application, package it as a WAR instead of a JAR by extending SpringBootServletInitializer and overriding the configure method. Next, merge your Angular dist files into the webapp directory of your Spring Boot project before packaging everything into a single WAR file.
Make sure to adjust server.servlet.context-path in your application.properties to match the Angular base href, and configure the Angular API calls to be relative. This should result in a successful integration on Tomcat.
hey man, you might wanna try packagin your angular app into the spring boot war file. just copy the dist folder contents into src/main/resources/static. then build the war and deploy it to tomcat. make sure u set the right context path in spring boot and angular. should work then!