hi there did anyone update SB recently? (I`m movin...
# spring
m
hi there did anyone update SB recently? (I`m moving from 2.5 to 2.7) Receiving
No default constructor found; nested exception is java.lang.NoSuchMethodException
on configuration class loading(with sb 2.6 and 2.7) that have been properly loaded(with SB 2.5) with constructor injection have I missed some important about bean configuration process updates?
m
Do you have appropriate plugins enabled?
I'm using SB 2.7.1, works pretty fine for me.
m
spring jpa yes but still @configuration doesn’t affected by jpa(no args) plugin for 2.5 and 2.6\2.7 either and constructor binding works fine thats whats confuse me
m
can you send here your
plugins {}
and the affected
@Configuration
class?
m
default
Copy code
apply plugin: "kotlin-jpa"
apply plugin: "kotlin-spring"
out contains this And its identical for both 2.5 and 2.6\2.7
m
have you tried to use
plugins {}
block instead?
m
I assume that plugins works as documented • jpa - `The plugin specifies
@Entity
,
@Embeddable
, and
@MappedSuperclass
no-arg annotations automatically` • spring - makes open
@Component @Async @Transactional @Cacheable @SpringBootTest
thats why I haven’t try any plugins manipulations and can’t understand what has been broken in my case
m
It looks like the plugins aren't applying somehow and this is why we should adjust your build script first
does the problem still appear on Kotlin 1.7.10 + SB plugin 2.7.1?
m
at the moments its 1.6.21 + 2.7.1
t
Copy code
@Configuration
class TodoService(
    private val todoRepository: TodoRepository,
    private val todoListRepository: TodoListRepository
) {
That`s your code?
m
that one already debbuged YmlFactory - it wokrs properly
t
are there multiple classes in one file?
m
yep
Copy code
@ConstructorBinding
@ConfigurationProperties("smart-server")
data class SmartServerProperties(
blablablah
) {
and another bean class
Copy code
class OneLineSmartServerLogger: Logger {
    private val lines = mutableListOf<String>()
    private val logger = Logger.DEFAULT

    override fun log(message: String) {
        lines.add(message)

        if (message.startsWith("BODY END")) {
            logger.log(lines.joinToString(separator = "\n"))
            lines.clear()
        }
    }
}
for ktor
t
m
was there - will try again
will recheck again - cos still regarding spring and kotlin documentation - it should work without default arg and its 🤯
t
yes it looks strange
it already was working even 😄
m
YES! thats why I came here)))
looks like it was mi migrations mistake I’ve rewrite it clearly step by step, separatly • kotlin bump • spring bump • etc and now it looks good
one more updt its not im trying to create in configuration KtorClient bean and setup it with properties data class created with constructor binding and it fails with no zero arg constructor last update THE last update 😂 it works properly if bean creation use all properties as args
Copy code
@Bean
    fun ktorClient(
        smartServerProperties: SmartServerProperties,
        @Value("\${http.connection-timeout}") httpConnectTimeout: Long,
        @Value("\${http.read-timeout}") httpReadTimeout: Long
    ) =
so it was my fail to try inject
Copy code
@ConstructorBinding
@ConfigurationProperties("smart-server")
data class SmartServerProperties(
to Configuration and missunderstanding of initialisation flow Tnx for your replies!