Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.2 final
-
Fix Version/s: 1.2.1
-
Component/s: Configuration
-
Labels:None
Description
Use of @Qualifier has no impact in Grails 1.2 on Spring beans that rely on @Autowired for dependency injection. I spent some time tracing it. Note that this used to work in 1.1.x. Here is what I've seen so far.
In Spring, the GenericApplicationContext creates a DefaultListableBeanFactory in its default constructor and sets it up with an QualifierAnnotationAutowireCandidateResolver, which is what detects @Qualifier.
In Grails, a GrailsApplicationContext can be created by DefaultRuntimeSpringConfiguration with a ReloadAwareAutowireCapableBeanFactory, which is not set up with the QualifierAnnotationAutowireCandidateResolver and therefore there is nothing to detect @Qualifier.
In my case I was able to work around the issue by adding primary="true" to one of my two SessionFactory bean instances thus helping to resolve the ambiguity but this will not work for every case.
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
fixed by http://github.com/grails/grails/commit/d9046e294ecda2ad46f1c94aaefe259a7e2790aa
I also added the LocalVariableTableParameterNameDiscoverer as GenericApplicationContext does