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
When using the application context to lookup beans of a certain type, I expect to get all beans associated with that type.
Actual Behaviour
When using the (micronaut-core) application context to lookup beans of a certain type, I get all beans associated with a certain type regardless of them having a named annotation or not.
When using the (micronaut-spring) application context to lookup beans of a certain type, I get a NoSuchBeanException if the bean I'm looking up is multiple named beans.
Steps To Reproduce
Create a ConfigurationProperty-class annotated with @EachProperty("a.b") and @Context the class should receive the named parameter in it's constructor
Create an ApplicationEventListener<StartupEvent> and inject both micronaut and spring application contexts
add properties a.b.a, a.b.b, a.b.c to application.yml
With the micronaut application context call micronautContext.getBeansOfType(Config.class) and get 3 configuration class beans.
With the spring adapted application context (MicronautApplicationContext class) call springContext.getBeansOfType(Config.class) and get a NoSuchBeanException with a message "No bean named 'Config(a)' available" (there might be a variation of either a, b or c as the name.)
The code doing the lookup through context is in the StartupListener class, I've also added a third example which is using the Spring BeanFactoryUtils
The exception thrown is NoSuchBeanDefinitionException and not NoSuchBeanException, I've also updated to micronaut 3.2.2, but the issue is present in 3.2.0 and 3.2.1 as well.
Expected Behavior
When using the application context to lookup beans of a certain type, I expect to get all beans associated with that type.
Actual Behaviour
Steps To Reproduce
ConfigurationProperty
-class annotated with@EachProperty("a.b")
and@Context
the class should receive the named parameter in it's constructorApplicationEventListener<StartupEvent>
and inject both micronaut and spring application contextsa.b.a
,a.b.b
,a.b.c
to application.ymlmicronautContext.getBeansOfType(Config.class)
and get 3 configuration class beans.springContext.getBeansOfType(Config.class)
and get aNoSuchBeanException
with a message"No bean named 'Config(a)' available"
(there might be a variation of either a, b or c as the name.)Environment Information
Example Application
Demo Application
Version
3.2.1
The text was updated successfully, but these errors were encountered: