I'm working on an application using spring-boot v1.3.5.RELEASE, which doesn't use @SpringBootApplication
nor @EnableAutconfiguration
(customer requirement).
I want to enable spring-boot-devtools
to have the "restart" feature in my IDE. I've put it as dependency, hit mvn spring-boot:run
. the restarter works:
DEBUG o.s.b.d.r.Restarter - Creating new Restarter for thread Thread[main,5,main]
DEBUG o.s.b.d.r.Restarter - Immediately restarting application
DEBUG o.s.b.d.r.Restarter - Created RestartClassLoader org.springframework.boot.devtools.restart.classloader.RestartClassLoader@22843e39
DEBUG o.s.b.d.r.Restarter - Starting application application.Application with URLs [file:/D:/git/repos/...]
But it doesn't reload after IDE code modification and rebluid (Ctrl+B on eclipse).
The problem seems to be that devtools relies on @EnableAutconfiguration
(factories loaded with the META-INF/spring.factories
) to be configured (and I can't use this annotation).
Basically, I need to do that by myself (see below the content of the devtools spring.factories
file):
# Application Initializers
org.springframework.context.ApplicationContextInitializer=\
org.springframework.boot.devtools.restart.RestartScopeInitializer
# Application Listeners
org.springframework.context.ApplicationListener=\
org.springframework.boot.devtools.restart.RestartApplicationListener
# Auto Configure
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.springframework.boot.devtools.autoconfigure.DevToolsDataSourceAutoConfiguration,\
org.springframework.boot.devtools.autoconfigure.LocalDevToolsAutoConfiguration,\
org.springframework.boot.devtools.autoconfigure.RemoteDevToolsAutoConfiguration
# Environment Post Processors
org.springframework.boot.env.EnvironmentPostProcessor=\
org.springframework.boot.devtools.env.DevToolsHomePropertiesPostProcessor,\
org.springframework.boot.devtools.env.DevToolsPropertyDefaultsPostProcessor
# Restart Listeners
org.springframework.boot.devtools.restart.RestartListener=\
org.springframework.boot.devtools.log4j2.Log4J2RestartListener
How can I do that (I'm not particulary fluent in spring-boot lingua) ?