0
votes

I have a Spring Boot application (2.2.6.RELEASE) that uses ReactJs as a frontend library. I have configured in application.properties a custom context-path and spring.mvc properties like so:

server.servlet.context-path=/gui
spring.mvc.view.prefix: /static/dist/
spring.mvc.view.suffix: .html
spring.mvc.static-path-pattern=/static/**

Webpack is used to build bundles and an index.html into src/main/resources/static/dist. Here is how the project structure looks like:

enter image description here

I need to be able to access index.html from

localhost:8080/gui

with these settings but for some reason it does not pick it up. However if I try with

localhost:8080/gui/static/dist/index.html

the resource is reached. How do I configure Spring to serve the resources as I would like to?

1
spring.resources.static-locations=classpath:/static/dist/Oleh Kurpiak
@OlehKurpiak that helped me out. Thank you!Stoyan Lupov

1 Answers

0
votes

@Oleh Kurpiak answer was correct. Using spring.resources.static-locations=classpath:/static/dist/ helped out.