Since @ConfigurationProperties
does not allow duplicated prefix. How to make the follow case to work? The following code will throw error as duplicated prefix is not allowed
abstract class Base {
var key: String
abstract fun execute()
}
@ConfigurationProperties(prefix = "test")
fun getA() : Base {
return object : Base {
override fun execute() {
// do something
}
}
}
@ConfigurationProperties(prefix = "test")
fun getB() : Base {
return object : Base {
override fun execute() {
// do something else
}
}
}
properties.yml
test:
key: value
Note the Base
class is in a lib so not possible to change