r/SpringBoot • • Aug 03 '24

Deploying of a spring boot &angular app

Hi I created a spring boot & angular application with mysql as a database and i want to learn how to deploy it. Is there any videos or articles I can follow because honestly i do not have any idea where to start from

24 Upvotes

14 comments sorted by

View all comments

7

u/bikeram Aug 03 '24

There's a few ways to do this.

My current method is using maven's frontend-maven-plugin. Maven compiles my Vue code, then copies it into my springboot target. This means my springboot.jar has everything. Then I can build a single docker container to deploy.

The other way to do this would be build a nginx container with all of your static angular code. Then reverse proxy to your springboot container.

On second thought, I'll throw together a repo. This can get pretty involved.

1

u/Dull_Specific_6496 Aug 03 '24

Thanks alot, i've never used docker before so i'll have to do some research

5

u/bikeram Aug 03 '24

https://github.com/santa-cruz07/springboot-frontend-example/tree/main

I'm heading to bed. I'll finish this over the weekend, but the major parts are there.

Pull the repo and look at

SpaRedirectFilterConfiguration.java

That's class has the magic to pass anything inside of REGEX to springboot. So you'll notice all my spring endpoints start with /api/.

Then vue uses /management/* for all of its routes.

You'll also need the vue/src/assembly/dist.xml and the vue/pom.xml build plugins.

The docker-compose, docker-files, and github actions are there too.