fun beans() = beans {
bean<PropertySourceLoggingEventListener>()
}
Not able to find an equivalent to
@Order
for ordering beans, e.g.
Copy code
@Bean
@Order(33)
fun someBean() = "abc"
Ideas on how provide equivalent ordering of beans?
k
kqr
07/09/2023, 7:45 AM
did you try implement
Ordered
interface?
c
Chris Lee
07/09/2023, 8:11 AM
Goal is to specify order at bean definition time without changing implementation, as with ‘@Order’
k
kqr
07/09/2023, 10:47 AM
curious, what is the use case?
kqr
07/09/2023, 11:12 AM
and btw does that even work?
Copy code
@Bean
@Order(33)
c
Chris Lee
07/09/2023, 12:56 PM
It works, it’s the recommended pattern when using configuration classes. Several use cases relating to injecting lists of beans of the same type, where the order matters.
Chris Lee
07/09/2023, 12:57 PM
Some of the types come from libraries and can’t otherwise use Ordered interface.