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
Its not possible to specify two repositories with the same name in different packages, because the beans are registered with the same name (uncapitalized non-qualified class name). So only the repository which was generated at least is in the bean definition or an BeanDefinitionStoreException occurs when bean definition overriding is not allowed.
Provide the ability to specify a specifiy bean name for a repository or a custom BeanNameGenerator strategy for bean name resolution. This is already possible in the core spring framework for naming autodetected components.
You definitiely have a point here but I'd like to lower the severity as there's an easy workaround by slightly renaming one of the candidate repository interfaces
The bean name to be used is now determined by an AnnotationBeanNameGenerator which inspects the Spring stereotype annotations or falls back to the simple interface name. Registering custom BeanNameGenerator is not supported yet but the currently implemented solution should provide enough functionality to naturally customize bean names if necessary
Are there any plans to allow registering a custom BeanNameGenerator? I feel the workaround using @Named a bit hardcoded. I am looking for somethin more 'dynamic'.
In our case, we have N repositories with the same name but in different feaures/packages (package visible to grant encapsulation), but with the currenly behaviour you could end up having name collisions.
I was thinking one of these options could replace the hardcoded delegate AnnotationBeanNameGenerator:
Andreas Hackl opened DATACMNS-168 and commented
Its not possible to specify two repositories with the same name in different packages, because the beans are registered with the same name (uncapitalized non-qualified class name). So only the repository which was generated at least is in the bean definition or an BeanDefinitionStoreException occurs when bean definition overriding is not allowed.
Provide the ability to specify a specifiy bean name for a repository or a custom BeanNameGenerator strategy for bean name resolution. This is already possible in the core spring framework for naming autodetected components.
or
Issue Links:
Referenced from: commits 874da36, b4a553e
Backported to: 1.5 Final, 1.4.1
1 votes, 5 watchers
The text was updated successfully, but these errors were encountered: