Issue 1:
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:

#14024 Regression: javax.inject.Provider resolution too agressive ("is duplicated by")

#14264 Injection of Provider fails for prototype-scoped beans ("is duplicated by")

#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

Issue 2:
divyabhardwaj opened SPR-4835 and commented

I am having an application made in Core spring(Spring+ JPA). I have converted this whole application into a jar . I m using this jar in another spring application (Client application). The applicationContext.xml of client application is importing the applicationContext present in the jar.I m getting the following error in doing so.

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleDAO': Injection of persistence methods failed; nested exception is java.lang.NoClassDefFoundError: javax.transaction.SystemException

at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:323)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:966)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)

at java.security.AccessController.doPrivileged(AccessController.java:197)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:184)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:430)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

at TestApp.main(TestApp.java:16)

Caused by: java.lang.NoClassDefFoundError: javax.transaction.SystemException

at java.lang.J9VMInternals.verifyImpl(Native Method)

at java.lang.J9VMInternals.verify(J9VMInternals.java:68)

at java.lang.J9VMInternals.verify(J9VMInternals.java:66)

at java.lang.J9VMInternals.initialize(J9VMInternals.java:129)

at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:39)

at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:34)

at org.springframework.orm.jpa.ExtendedEntityManagerCreator.createContainerManagedEntityManager(ExtendedEntityManagerCreator.java:197)

at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveExtendedEntityManager(PersistenceAnnotationBeanPostProcessor.java:625)

at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProcessor.java:567)

at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:193)

at org.springframework.beans.factory.annotation.InjectionMetadata.injectMethods(InjectionMetadata.java:116)

at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:320)

Please help me in solving the above issue.

Issue Links:

#9512 ApplicationContext.xml cannot read another applicationContext present in the jar (present in classpath of Project) ("is duplicated by")