-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
Greg Thompson opened SPR-9181 and commented
I have a session scoped bean. It's marked with <aop:scoped-proxy />. I'm trying to inject a Provider or ObjectFactory into the session bean using @Inject
or @Autowired
. It injects fine the first time the session bean is created. On the second creation of the session bean (for a 2nd session), I get java.lang.IllegalArgumentException when setting the @Inject
or @Autowired
property. It's trying to set the actual bean, instead of a provider or an object factory.
I stepped through the code. The code in the getDependencyType() method of DependencyDescriptor doesn't seem to work as expected when it's setting the value on the second session bean. Something with the nesting level. So, I don't get a DependencyProvider as expected in the resolveDependency method of DefaultListableBeanFactory class. The getDependencyType returns the class of the bean, instead of a provider or object factory class that is the type of the property.
This worked fine with 3.0.
Attachments:
- SPR-9181.tgz (4.89 kB)
Issue Links:
- Regression: javax.inject.Provider resolution too agressive [SPR-9388] #14024 Regression: javax.inject.Provider resolution too agressive ("is duplicated by")
- Injection of Provider fails for prototype-scoped beans [SPR-9630] #14264 Injection of Provider fails for prototype-scoped beans ("is duplicated by")
- Automatically created java.inject.Provider cannot be injected into session scoped beans [SPR-9845] #14478 Automatically created java.inject.Provider cannot be injected into session scoped beans ("is duplicated by")
Referenced from: commits 1bd775f, fbe955a
6 votes, 8 watchers