'Package React + Springboot application into .war file

How can I transform a React + Springboot application into a .war file



Solution 1:[1]

You should be able to simply package the react production build and serve it statically from a Springboot application.

Here's a quick tutorial on how this can be done fairly easily while still being able to call API routes on the same domain.

https://www.kantega.no/blogg/webapp-with-create-react-app-and-spring-boot

P.S. This tutorial is intended for a jar build but making a war instead shouldn't be much different, might be to just change the value in the config file.

Solution 2:[2]

I would make docker files, and split the react app and the spring boot be. Then you create a docker-compose file and do a docker-compose up on server.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 anteAdamovic
Solution 2 SupaMario