Skip to content

larmic/kotlin-spring-boot-config-properties-bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kotlin 1.2.20 with Spring Boot 2.0.0.M7 and @ConfigurationProperties

This tiny example shows a bug when upgrading from Kotlin 1.2.10 to 1.2.20

When build with 1.2.20 this error occurs

Caused by: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'larmic' to de.larmic.kotlin.bug.Configuration
	at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:227)
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:203)
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:187)
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:169)
	at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.bind(ConfigurationPropertiesBinder.java:77)
	at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:167)
	... 41 more
Caused by: org.springframework.boot.context.properties.bind.validation.BindValidationException
	at org.springframework.boot.context.properties.bind.validation.ValidationBindHandler.throwBindValidationException(ValidationBindHandler.java:128)
	at org.springframework.boot.context.properties.bind.validation.ValidationBindHandler.validate(ValidationBindHandler.java:116)
	at org.springframework.boot.context.properties.bind.validation.ValidationBindHandler.validate(ValidationBindHandler.java:97)
	at org.springframework.boot.context.properties.bind.validation.ValidationBindHandler.onFinish(ValidationBindHandler.java:88)
	at org.springframework.boot.context.properties.bind.Binder.handleBindResult(Binder.java:213)
	at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:200)
	... 45 more

When build with 1.2.10 no error occurs

When removing validation no exception occurs but properties are not injected.

See bugs:

Workaround: add <kotlin.compiler.incremental>false</kotlin.compiler.incremental> to properties in pom.xml

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages