Skip to content

MCVE for Kotlin data properties seemingly not working

ericjturley/mcve-configurationproperties

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MCVE for Kotlin data properties seemingly not working

Answer

Turns out, I was missing the kotlin-reflect dependency https://gitter.im/spring-projects/spring-boot?at=5de9385a08d0c961b7f7758a But the failure isn't handled well by Spring Boot

Replication

When I run the ConfigurationPropertiesTest, I get:

java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'push1-ind.ericjturley.mcve.configurationproperties.PushServicesProperties1': Unsatisfied dependency expressed through constructor parameter 0; nested exception is ...
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'ind.ericjturley.mcve.configurationproperties.PushServicesProperties1$SnsClient' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

Looks like commenting out @ConfigurationProperties on the .kt class PushServiceProperties1 will toggle the failure. (I had originally thought it was the injection into the test class)

Overview

These classes are pulled from an existing project (and possibly renamed).

The project is a library intended for use in a Spring Boot Application. Hence, it doesn't have spring-boot-starter-parent as a parent, but does:

  • import the spring-boot-dependencies bom
  • depend on spring-boot-starter

It's mostly Java, with a few Kotlin classes/files.

About

MCVE for Kotlin data properties seemingly not working

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published