ppalaga commented on issue #3002: URL: https://github.com/apache/camel-quarkus/issues/3002#issuecomment-901817107
The real cause is a little bit different than my original guess. As I assumed, there are two instances of the builder per class: one with context set properly, and one with no context. But it is not because one is created by us and the other one by Arc. Both are created by Arc and it is correct so. Because the builder class has no explicit CDI scope, it gets the default `@Dependent` pseudo-scope. That basically means that each lookup or injection gives a new instance. Listing container beans once (when adding builders to the context) gives another instance than when listing them second time (when checking that they have context set). I wonder what contract was the test actually supposed to check? I am not aware that we promise auto-setting the context to each and every bean (including end user ones) that implements `CamelContextAware`. Yes, we set the context on the RouteBuilders and perhaps also in some other special cases, but there's no general contract about that, is there? Perhaps we just wanted to make sure that all RouteBuilders managed by Arc get the context set properly? If so, then the test should IMO lookup only some specific RouteBuilder bean that we fix to have proper scope set. While having RouteBuilders in `@Dependent` scope is perhaps mostly not a good idea, I am still not quite sure we should introduce any measures to prevent/warn about it. WDYT? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org