EricJTurley
11/26/2019, 7:50 PM@ConstructorBinding
@ConfigurationProperties("push")
data class PushServicesProperties(val snsClient: SnsClient) {
data class SnsClient(
val maxConnections: Int,
val connectionTimeout: Int,
val socketTimeout: Int,
val proxyHost: String,
val proxyPort: Int
)
}
But I'm still getting No default constructor found
for the PushServiceProperties
class.
Has anyone else had that problem? Everything looks normal...Egor Babarykin
11/26/2019, 8:18 PMplugins {
...
kotlin("kapt") version "1.3.60"
}
dependencies {
...
kapt("org.springframework.boot:spring-boot-configuration-processor")
}
Egor Babarykin
11/26/2019, 8:19 PMEricJTurley
11/26/2019, 8:19 PMEricJTurley
11/26/2019, 8:20 PMEricJTurley
11/26/2019, 8:20 PMEricJTurley
11/26/2019, 8:23 PMkapt
to make @ConstructorBinding
work? Or just to make metadata-generation work?EricJTurley
11/26/2019, 8:40 PMEmerson Farrugia
11/27/2019, 3:30 PMCzar
11/28/2019, 6:05 AM@ConstructorBinding
data class SnsClient(
//...
no other changes are necessary, kapt
stuff is only needed for metadata generation.kqr
11/28/2019, 1:05 PMEricJTurley
11/28/2019, 4:53 PMEricJTurley
11/28/2019, 4:54 PM@ConstructorBinding
annotation should extend to the nested properties classes.Czar
11/28/2019, 4:55 PMEricJTurley
11/28/2019, 5:01 PM@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE/*mocked*/,
classes = EndpointRegistrationServicesConfiguration.class)
class PushServicePropertiesTest {
@Autowired
PushServicesProperties pushServicesProperties; // <--- Java properties class
@Autowired
PushProperties1 pushProperties1; // <--- Kotlin data properties class
}
And I get:
ConfigurationPropertiesBindException
Could not bind properties to 'PushProperties1'
BeanInstantiationException 'PushProperties1'
No default constructor found
NoSuchMethodException: com.blizzard.bnet.push.endpoint.services.PushProperties1.<init>()
EricJTurley
12/02/2019, 9:05 PM2.2.1
, so I upgraded.
But now I get a different error regarding the nested SnSClient
class:
Parameter 0 of constructor in com.blizzard.bnet.push.endpoint.services.PushServicesProperties1 required a bean of type 'com.blizzard.bnet.push.endpoint.services.PushServicesProperties1$SnsClient' that could not be found.
Failed to load ApplicationContext
No qualifying bean of type 'com.blizzard.bnet.push.endpoint.services.PushServicesProperties1$SnsClient' available
EricJTurley
12/02/2019, 9:06 PM@ConstructorBinding
annotation to the inner classEricJTurley
12/02/2019, 9:08 PM@ConstructorBinding
@ConfigurationProperties("push1")
data class PushServicesProperties1(val snsClient: SnsClient) {
@ConstructorBinding
data class SnsClient(
val maxConnections: Int = -1,
val connectionTimeout: Int = 10000,
val socketTimeout: Int = 10000,
val proxyHost: String = "",
val proxyPort: Int? = null
)
}