The following WARN
shows up when adding spring-boot-devtools
and spring-boot-properties-migrator
in a vanilla spring-boot-2.4.0
application:
2020-11-18 14:40:06.087 INFO 15872 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-11-18 14:40:06.391 WARN 15872 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : Unable to start LiveReload server
2020-11-18 14:40:06.401 INFO 15872 --- [ restartedMain] com.example.demo.DemoApplication : Started DemoApplication in 0.599 seconds (JVM running for 0.893)
2020-11-18 14:40:06.405 WARN 15872 --- [ restartedMain] o.s.b.c.p.m.PropertiesMigrationListener :
The use of configuration keys that have been renamed was found in the environment:
Property source 'devtools':
Key: spring.resources.cache.period
Replacement: spring.web.resources.cache.period
Key: spring.resources.chain.cache
Replacement: spring.web.resources.chain.cache
Each configuration key has been temporarily mapped to its replacement for your convenience. To silence this warning, please update your configuration to use the new keys.
Comment From: snicoll
Thanks for the report, this is a corner case where we had to restructure the configuration a bit and decided to use a common parent that led to some property to be both created and deprecated at the same time. I'll investigate how to handle that case and whether we should reconsider this arrangement.
Comment From: wilkinsona
Isn't this due to me forgetting to rename a couple of properties when I moved the spring.resources
properties under spring.web
?
https://github.com/spring-projects/spring-boot/blob/15c44aa45f4294aea2c542d8815601b68f967674/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java#L72-L73
Comment From: snicoll
Ah ha! Yeah ok, my gut instinct told me adding and deprecating a property in the same release could have led to this but that snippet makes way more sense.
Comment From: matthewlowry
For the record, I stumbled onto this when I upgraded an project from Spring Boot 1.5 straight to 2.4 (it was !!FUN!!
).
I'm not using spring-boot-properties-migrator
and for me this bug manifests as the application failing to start.
2020-11-27 07:09:49.293 ERROR 34423 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'spring.resources.cache.period' to java.time.Duration:
Property: spring.resources.cache.period
Value: 0
Origin: "spring.resources.cache.period" from property source "devtools"
Reason: failed to convert java.lang.String to @org.springframework.boot.convert.DurationUnit java.time.Duration
Action:
Update your application's configuration
I tried adding the migrator and I see the same WARN
log that @didiez reported but still the application still refuses to start for me.
No big deal, and easy to work around (spring.devtools.add-properties: false
in application.yml
) until 2.4.1 is released.
Comment From: snicoll
@matthewlowry thanks for the feedback. Odd, I did not reproduce this myself. Can you double check that your app (without the spring.devtools.add-properties
) works with 2.4.1-SNAPSHOT
? If It doesn't, a separate issue with more details about your setup would be very much appreciated.
Comment From: mishraShubhamOyo
spring.devtools.add-properties: false
For the record, I stumbled onto this when I upgraded an project from Spring Boot 1.5 straight to 2.4 (it was
!!FUN!!
). I'm not usingspring-boot-properties-migrator
and for me this bug manifests as the application failing to start.``` 2020-11-27 07:09:49.293 ERROR 34423 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
Failed to bind properties under 'spring.resources.cache.period' to java.time.Duration:
Property: spring.resources.cache.period Value: 0 Origin: "spring.resources.cache.period" from property source "devtools" Reason: failed to convert java.lang.String to @org.springframework.boot.convert.DurationUnit java.time.Duration
Action:
Update your application's configuration ```
I tried adding the migrator and I see the same
WARN
log that @didiez reported but still the application still refuses to start for me.No big deal, and easy to work around (
spring.devtools.add-properties: false
inapplication.yml
) until 2.4.1 is released.
Same error is also coming in my upgradation from springboot 1.5 to 2.0.5.RELEASE, added spring.devtools.add-properties: false. still issue is there
Comment From: snicoll
@mishraShubhamOyo did you mean 2.0.5.RELEASE
? This issue applies to 2.4.0
....
Comment From: mishraShubhamOyo
@mishraShubhamOyo did you mean
2.0.5.RELEASE
? This issue applies to2.4.0
....
Can u help me here for spring 2..0.5.RELEASE?
Comment From: snicoll
@mishraShubhamOyo please ask question on StackOverflow.