<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=gthomps95" rel="nofollow">Greg Thompson</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-9181?redirect=false" rel="nofollow">SPR-9181</a></strong> and commented</p>
<p dir="auto">I have a session scoped bean.  It's marked with &lt;aop:scoped-proxy /&gt;.  I'm trying to inject a Provider or ObjectFactory into the session bean using <code class="notranslate">@Inject</code> or <code class="notranslate">@Autowired</code>.  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 <code class="notranslate">@Inject</code> or <code class="notranslate">@Autowired</code> property.  It's trying to set the actual bean, instead of a provider or an object factory.</p>
<p dir="auto">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.</p>
<p dir="auto">This worked fine with 3.0.</p>
<hr>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/19995/SPR-9181.tgz" rel="nofollow">SPR-9181.tgz</a> (<em>4.89 kB</em>)</li>
</ul>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398119000" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/14024" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/14024/hovercard" href="https://github.com/spring-projects/spring-framework/issues/14024">#14024</a> Regression: javax.inject.Provider resolution too agressive (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398152065" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/14264" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/14264/hovercard" href="https://github.com/spring-projects/spring-framework/issues/14264">#14264</a> Injection of Provider fails for prototype-scoped beans (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398153775" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/14478" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/14478/hovercard" href="https://github.com/spring-projects/spring-framework/issues/14478">#14478</a> Automatically created java.inject.Provider cannot be injected into session scoped beans (<em><strong>"is duplicated by"</strong></em>)</li>
</ul>
<p dir="auto"><strong>Referenced from:</strong> commits <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/1bd775f828ddb1f2919c2a57b1151dc3cca9f14c/hovercard" href="https://github.com/spring-projects/spring-framework/commit/1bd775f828ddb1f2919c2a57b1151dc3cca9f14c"><tt>1bd775f</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/fbe955ab284f5782b80a852b84933af14c32b006/hovercard" href="https://github.com/spring-projects/spring-framework/commit/fbe955ab284f5782b80a852b84933af14c32b006"><tt>fbe955a</tt></a></p>
<p dir="auto">6 votes, 8 watchers</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=divyabhardwaj" rel="nofollow">divyabhardwaj</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-4835?redirect=false" rel="nofollow">SPR-4835</a></strong> and commented</p>
<p dir="auto">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.</p>
<p dir="auto">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<br>
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:323)<br>
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:966)<br>
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)<br>
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)<br>
at java.security.AccessController.doPrivileged(AccessController.java:197)<br>
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)<br>
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)<br>
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)<br>
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)<br>
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:184)<br>
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163)<br>
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:430)<br>
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)<br>
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)<br>
at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:139)<br>
at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:83)<br>
at TestApp.main(TestApp.java:16)<br>
Caused by: java.lang.NoClassDefFoundError: javax.transaction.SystemException<br>
at java.lang.J9VMInternals.verifyImpl(Native Method)<br>
at java.lang.J9VMInternals.verify(J9VMInternals.java:68)<br>
at java.lang.J9VMInternals.verify(J9VMInternals.java:66)<br>
at java.lang.J9VMInternals.initialize(J9VMInternals.java:129)<br>
at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:39)<br>
at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:34)<br>
at org.springframework.orm.jpa.ExtendedEntityManagerCreator.createContainerManagedEntityManager(ExtendedEntityManagerCreator.java:197)<br>
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveExtendedEntityManager(PersistenceAnnotationBeanPostProcessor.java:625)<br>
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProcessor.java:567)<br>
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:193)<br>
at org.springframework.beans.factory.annotation.InjectionMetadata.injectMethods(InjectionMetadata.java:116)<br>
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:320)</p>
<p dir="auto">Please help me in solving the above issue.</p>
<hr>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398088504" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/9512" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/9512/hovercard" href="https://github.com/spring-projects/spring-framework/issues/9512">#9512</a> ApplicationContext.xml cannot  read another applicationContext present in the jar (present in classpath of Project) (<em><strong>"is duplicated by"</strong></em>)</li>
</ul>