1

I want to include static content in Spring boot JAR application. I understood it's recommended to not use /src/main/webapp.

But with IntelliJ, the application run correctly. I tried to change to

/src/main/resources

or

/src/main/public

, but it doesnt work.

/public works, but I dont think its is a good solution.

How I rename static directory and where I have to move please ?

thanks

2
  • Why isn't correct for it to be placed in /src/main/webapp? That's where the public content should go in a Maven app. Commented Sep 22, 2015 at 19:11
  • spring-boot Documentation Do not use the src/main/webapp directory if your application will be packaged as a jar Commented Sep 23, 2015 at 10:03

1 Answer 1

1

/src/main/resources is the base folder for all resources. If you place a static|public|resources|META-INF/resources folder inside of it the content should be served (e.g. /src/main/resources/static)

Sign up to request clarification or add additional context in comments.

2 Comments

I had tried, but I think I needed to do clean and package before. Now its working, many thanks
This is not the best way to do it. Serving from /src/main/resources you will run into problems with live update. You should serve from /static (not in the resources folder - just from your root project folder) as it says in the spring boot docs.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.