You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Only the last RouterFunction<> is available with the Kotlin bean DSL #14295
I have an app that add several RouterFunction<ServerResponse> with the Kotlin bean DSL and
only the routes from the latest bean of type RouterFunction<> is available on the server.
I have test this app with Spring-boot 2.0.4 and 2.1.0.M2 on Netty.
This is a sample app. You can change the order of the two router declaration and re-run the Unit test.
This looks like a usability/implementation/documentation issue in the bean registration DSL. I've created SPR-17242 for that. It seems defining multiple beans of the same types without providing a bean name is the source of the problem here.
In the meantime, you can use the @Bean variant when registering beans, or add bean names like this:
val beans = beans {
// TODO Change the order of the declaration
bean("fooRouter") { fooRouter() }
bean("barRouter") { barRouter() }
}
I'm closing this issue as there's nothing we can do in Spring Boot.
Activity
bclozel commentedon Sep 4, 2018
Hi @tgirard12 , thanks for the repro project.
This looks like a usability/implementation/documentation issue in the bean registration DSL. I've created SPR-17242 for that. It seems defining multiple beans of the same types without providing a bean name is the source of the problem here.
In the meantime, you can use the
@Beanvariant when registering beans, or add bean names like this:I'm closing this issue as there's nothing we can do in Spring Boot.
tgirard12 commentedon Sep 6, 2018
Thanks for the quick reply and creating this issue, it fixed my problem.