1

Is it possible to use spring-boot-devtools in a Spring MVC project?

I basically want the .jsp pages and other static resources to reload automatically without server restart.

1 Answer 1

1

try with these : add a configuration bean and see if your jsp files are getting loaded

@Configuration
class WebMvcConfigurer extends WebMvcConfigurerAdapter {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/dist/*.js").addResourceLocations(
            "file:src/main/dist/"
        );
    }
}

or in the pom.xml , along with the spring-boot-maven-plugin add this

<configuration>
    <addResources>true</addResources>
</configuration>

I am not sure where you are putting your static content in the classpath , may be in src/main/resources/public folder. Instead put them in src/main/webapp, the same as you would any other Java web app. The embedded Tomcat will automatically reload them whenever they change.

Not the answer you're looking for? Browse other questions tagged or ask your own question.