Announcement Announcement Module
Collapse
No announcement yet.
Spring Data 1.2 -> 1.3 migration causing Spring context error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Data 1.2 -> 1.3 migration causing Spring context error

    Hi everyone,


    I've been working with Spring data for a several months,
    (and btw, thx to the development team to provide such a good high level framework)...

    but when I change my pom.xml config, moving from Spring data 1.2.0 to Spring data 1.3.* (either 0 or 1),

    my JUnit tests (previously working well, for months) fails on start up...

    (at context initialization, the first bean to be injected for dependencies is not found throwing a "org.springframework.beans.factory.NoSuchBeanDefin itionException: No qualifying bean of type...")


    previous pom part (OK)

    Code:
    <dependency>
    <groupId>org.springframework.data</groupId>
    	<artifactId>spring-data-jpa</artifactId>
    	<version>1.2.0.RELEASE</version>
    </dependency>   	
    <dependency>
    	<groupId>org.springframework.data</groupId>
    	<artifactId>spring-data-commons-core</artifactId>
    	<version>1.4.0.RELEASE</version>
    </dependency>
    new version (NOK)

    Code:
      	
    <dependency>
    	<groupId>org.springframework.data</groupId>
    	<artifactId>spring-data-jpa</artifactId>
    	<version>1.3.1.RELEASE</version>
    </dependency>
    with or without an additional (NOK)

    Code:
    <dependency>
    	<groupId>org.springframework.data</groupId>
    	<artifactId>spring-data-commons</artifactId>
    	<version>1.5.1.RELEASE</version>
    </dependency>
    SpringFramework 3.2.1.RELEASE version used...

    my context.xml file declares

    Code:
    <beans 
    	xmlns="http://www.springframework.org/schema/beans"
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xmlns:context="http://www.springframework.org/schema/context"
      	xmlns:tx="http://www.springframework.org/schema/tx"
      	xmlns:jpa="http://www.springframework.org/schema/data/jpa"
      	xmlns:security="http://www.springframework.org/schema/security"
      	xmlns:aop="http://www.springframework.org/schema/aop"
      	
       	xsi:schemaLocation="http://www.springframework.org/schema/beans 			http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
      						http://www.springframework.org/schema/context 			http://www.springframework.org/schema/context/spring-context-3.2.xsd
      						http://www.springframework.org/schema/tx				http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
      						http://www.springframework.org/schema/data/jpa			http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
      						http://www.springframework.org/schema/aop 				http://www.springframework.org/schema/aop/spring-aop.xsd
      						http://www.springframework.org/schema/security 			http://www.springframework.org/schema/security/spring-security-3.1.xsd">


    I was thinking there might be a dependency issue, but as the spring-data project has only its commons-core as dependency declaration, i don't think it's that path to be searched...

    any idea gentlemen ???

    thx


    i42

  • #2
    After digging, I think the only cause could come from a library conflict,
    but when exploring the difference between the Spring Data JPA 1.2 and 1.3 pom.xml (), I don't see any potential problem... as missing library will be transitively resolved...

    does any of you see any conflict with this maven dependency list... ???

    any help will be warmly welcomed...

    thx


    i42


    Code:
      <properties>
        <spring.version>3.2.2.RELEASE</spring.version>
        <spring.security.version>3.2.0.M1</spring.security.version>
        <slf4j.version>1.7.2</slf4j.version>
        <hibernate>4.2.0.CR1</hibernate>
      </properties>
      
      
      <dependencies>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-core</artifactId>
      		<version>${spring.version}</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-aop</artifactId>
      		<version>${spring.version}</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-aspects</artifactId>
      		<version>${spring.version}</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-beans</artifactId>
      		<version>${spring.version}</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-context</artifactId>
      		<version>${spring.version}</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-context-support</artifactId>
      		<version>${spring.version}</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-expression</artifactId>
      		<version>${spring.version}</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-jdbc</artifactId>
      		<version>${spring.version}</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-orm</artifactId>
      		<version>${spring.version}</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-test</artifactId>
      		<version>${spring.version}</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-tx</artifactId>
      		<version>${spring.version}</version>
      	</dependency>
      	
    	<dependency>
    		<groupId>org.springframework.security</groupId>
    		<artifactId>spring-security-acl</artifactId>
    		<version>${spring.security.version}</version>
    	</dependency>
    	<dependency>
    		<groupId>org.springframework.security</groupId>
    		<artifactId>spring-security-aspects</artifactId>
    		<version>${spring.security.version}</version>
    	</dependency>
    	<dependency>
    		<groupId>org.springframework.security</groupId>
    		<artifactId>spring-security-cas</artifactId>
    		<version>${spring.security.version}</version>
    	</dependency>
    	<dependency>
    		<groupId>org.springframework.security</groupId>
    		<artifactId>spring-security-config</artifactId>
    		<version>${spring.security.version}</version>
    	</dependency>
    	<dependency>
    		<groupId>org.springframework.security</groupId>
    		<artifactId>spring-security-core</artifactId>
    		<version>${spring.security.version}</version>
    	</dependency>
    	<dependency>
    		<groupId>org.springframework.security</groupId>
    		<artifactId>spring-security-crypto</artifactId>
    		<version>${spring.security.version}</version>
    	</dependency>
    	<dependency>
    		<groupId>org.springframework.security</groupId>
    		<artifactId>spring-security-ldap</artifactId>
    		<version>${spring.security.version}</version>
    	</dependency>
    	<dependency>
    		<groupId>org.springframework.security</groupId>
    		<artifactId>spring-security-openid</artifactId>
    		<version>${spring.security.version}</version>
    	</dependency>
    	<dependency>
    		<groupId>org.springframework.security</groupId>
    		<artifactId>spring-security-remoting</artifactId>
    		<version>${spring.security.version}</version>
    	</dependency>  	
      	
      	<dependency>
      		<groupId>org.hibernate.javax.persistence</groupId>
      		<artifactId>hibernate-jpa-2.0-api</artifactId>
      		<version>1.0.1.Final</version>
      	</dependency>  	
      	  	<dependency>
      		<groupId>org.hibernate.common</groupId>
      		<artifactId>hibernate-commons-annotations</artifactId>
      		<version>4.0.1.Final</version>
      	</dependency>
      	<dependency>
      		<groupId>org.hibernate</groupId>
      		<artifactId>hibernate-core</artifactId>
      		<version>${hibernate}</version>
      	</dependency>
      	<dependency>
      		<groupId>org.hibernate</groupId>
      		<artifactId>hibernate-entitymanager</artifactId>
      		<version>${hibernate}</version>
      	</dependency>
      	
      	
      	
      	<dependency>
      		<groupId>aopalliance</groupId>
      		<artifactId>aopalliance</artifactId>
      		<version>1.0</version>
      	</dependency>
      	<dependency>
      		<groupId>antlr</groupId>
      		<artifactId>antlr</artifactId>
      		<version>2.7.7</version>
      	</dependency>
      	<dependency>
      		<groupId>cglib</groupId>
      		<artifactId>cglib-nodep</artifactId>
      		<version>2.2.2</version>
      	</dependency>
      	<dependency>
      		<groupId>commons-beanutils</groupId>
      		<artifactId>commons-beanutils</artifactId>
      		<version>1.8.3</version>
      	</dependency>
      	<dependency>
      		<groupId>commons-codec</groupId>
      		<artifactId>commons-codec</artifactId>
      		<version>1.7</version>
      	</dependency>
      	<dependency>
      		<groupId>commons-collections</groupId>
      		<artifactId>commons-collections</artifactId>
      		<version>3.2.1</version>
      	</dependency>
      	<dependency>
      		<groupId>commons-digester</groupId>
      		<artifactId>commons-digester</artifactId>
      		<version>2.1</version>
      	</dependency>
      	<dependency>
      		<groupId>commons-el</groupId>
      		<artifactId>commons-el</artifactId>
      		<version>1.0</version>
      	</dependency>
      	<dependency>
      		<groupId>commons-fileupload</groupId>
      		<artifactId>commons-fileupload</artifactId>
      		<version>1.2.2</version>
      	</dependency>
      	<dependency>
      		<groupId>commons-io</groupId>
      		<artifactId>commons-io</artifactId>
      		<version>2.4</version>
      	</dependency>
      	<dependency>
      		<groupId>commons-lang</groupId>
      		<artifactId>commons-lang</artifactId>
      		<version>2.6</version>
      	</dependency>
      	<dependency>
      		<groupId>commons-logging</groupId>
      		<artifactId>commons-logging</artifactId>
      		<version>1.1.1</version>
      	</dependency>
      	<dependency>
      		<groupId>commons-validator</groupId>
      		<artifactId>commons-validator</artifactId>
      		<version>1.4.0</version>
      	</dependency>
      	<dependency>
      		<groupId>dom4j</groupId>
      		<artifactId>dom4j</artifactId>
      		<version>1.6.1</version>
      	</dependency>
      	<dependency>
      		<groupId>net.sf.ehcache</groupId>
      		<artifactId>ehcache-core</artifactId>
      		<version>2.6.3</version>
      	</dependency>
      	<dependency>
      		<groupId>org.jboss.logging</groupId>
      		<artifactId>jboss-logging</artifactId>
      		<version>3.1.2.GA</version>
      	</dependency>
      	<dependency>
      		<groupId>org.jboss.spec.javax.transaction</groupId>
      		<artifactId>jboss-transaction-api_1.1_spec</artifactId>
      		<version>1.0.1.Final</version>
      	</dependency>
      	<dependency>
      		<groupId>junit</groupId>
      		<artifactId>junit</artifactId>
      		<version>4.11</version>
      	</dependency>
      	<dependency>
      		<groupId>org.apache.logging.log4j</groupId>
      		<artifactId>log4j</artifactId>
      		<version>2.0-beta4</version>
      		<type>pom</type>
      	</dependency>
      	<dependency>
      		<groupId>org.apache.logging.log4j</groupId>
      		<artifactId>log4j-api</artifactId>
      		<version>2.0-beta4</version>
      	</dependency>
      	<dependency>
      		<groupId>org.apache.logging.log4j</groupId>
      		<artifactId>log4j-core</artifactId>
      		<version>2.0-beta4</version>
      	</dependency>
      	<dependency>
      		<groupId>org.projectlombok</groupId>
      		<artifactId>lombok</artifactId>
      		<version>0.11.6</version>
      	</dependency>
    
    	<dependency>
      		<groupId>org.slf4j</groupId>
      		<artifactId>slf4j-log4j12</artifactId>
      		<version>${slf4j.version}</version>
      	</dependency>
      	
      	<dependency>
      		<groupId>org.javassist</groupId>
      		<artifactId>javassist</artifactId>
      		<version>3.15.0-GA</version>
      	</dependency>
      	<dependency>
      		<groupId>net.sourceforge.jtds</groupId>
      		<artifactId>jtds</artifactId>
      		<version>1.2.6</version>
      	</dependency>
      	
    	<dependency>
    		<groupId>com.lowagie</groupId>
    		<artifactId>itext</artifactId>
    		<version>4.2.0</version>
    	</dependency>        
    	<dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <version>5.1.0</version>
        </dependency>
    	<dependency>
    		<groupId>com.github.springtestdbunit</groupId>
    		<artifactId>spring-test-dbunit</artifactId>
    		<version>1.0.1</version>
    		<scope>test</scope>
    	</dependency>
    	<dependency>
    		<groupId>org.hsqldb</groupId>
    		<artifactId>hsqldb</artifactId>
    		<version>2.2.9</version>
    		<scope>test</scope>
    	</dependency>
    	<dependency>
    		<groupId>org.dbunit</groupId>
    		<artifactId>dbunit</artifactId>
    		<version>2.4.9</version>
    		<type>jar</type>
    		<scope>test</scope>
    		<exclusions>
    			<exclusion>
    				<artifactId>slf4j-api</artifactId>
    				<groupId>org.slf4j</groupId>
    			</exclusion>
    		</exclusions>
    	</dependency>
    	<dependency>
    		<groupId>org.apache.commons</groupId>
    		<artifactId>commons-lang3</artifactId>
    		<version>3.1</version>
    	</dependency>
    	
    	<dependency>
      		<groupId>org.springframework.data</groupId>
      		<artifactId>spring-data-jpa</artifactId>
      		<version>1.3.0.RELEASE</version>
      	</dependency>
    	
    	
      </dependencies>

    Comment


    • #3
      my maven dependency:list outputs the following content, do you see any conflict ???

      Code:
      [INFO] --- maven-dependency-plugin:2.1:list (default-cli) @ FiviaServices ---
      [INFO] 
      [INFO] The following files have been resolved:
      [INFO]    antlr:antlr:jar:2.7.7:compile
      [INFO]    aopalliance:aopalliance:jar:1.0:compile
      [INFO]    cglib:cglib-nodep:jar:2.2.2:compile
      [INFO]    com.fasterxml.jackson.core:jackson-annotations:jar:2.0.5:compile
      [INFO]    com.fasterxml.jackson.core:jackson-core:jar:2.0.5:compile
      [INFO]    com.fasterxml.jackson.core:jackson-databind:jar:2.0.5:compile
      [INFO]    com.github.springtestdbunit:spring-test-dbunit:jar:1.0.1:test
      [INFO]    com.google.inject:guice:jar:2.0:compile
      [INFO]    com.lowagie:itext:jar:4.2.0:compile
      [INFO]    commons-beanutils:commons-beanutils:jar:1.8.3:compile
      [INFO]    commons-codec:commons-codec:jar:1.7:compile
      [INFO]    commons-collections:commons-collections:jar:3.2.1:compile
      [INFO]    commons-digester:commons-digester:jar:2.1:compile
      [INFO]    commons-el:commons-el:jar:1.0:compile
      [INFO]    commons-fileupload:commons-fileupload:jar:1.2.2:compile
      [INFO]    commons-io:commons-io:jar:2.4:compile
      [INFO]    commons-lang:commons-lang:jar:2.6:compile
      [INFO]    commons-logging:commons-logging:jar:1.1.1:compile
      [INFO]    commons-validator:commons-validator:jar:1.4.0:compile
      [INFO]    dom4j:dom4j:jar:1.6.1:compile
      [INFO]    eclipse:jdtcore:jar:3.1.0:compile
      [INFO]    jfree:jcommon:jar:1.0.15:compile
      [INFO]    jfree:jfreechart:jar:1.0.12:compile
      [INFO]    junit:junit:jar:4.11:compile
      [INFO]    log4j:log4j:jar:1.2.17:compile
      [INFO]    net.jcip:jcip-annotations:jar:1.0:compile
      [INFO]    net.sf.ehcache:ehcache-core:jar:2.6.3:compile
      [INFO]    net.sf.jasperreports:jasperreports:jar:5.1.0:compile
      [INFO]    net.sourceforge.jtds:jtds:jar:1.2.6:compile
      [INFO]    org.apache.commons:commons-lang3:jar:3.1:compile
      [INFO]    org.apache.httpcomponents:httpclient:jar:4.1.1:runtime
      [INFO]    org.apache.httpcomponents:httpcore:jar:4.1:runtime
      [INFO]    org.apache.logging.log4j:log4j:pom:2.0-beta4:compile
      [INFO]    org.apache.logging.log4j:log4j-api:jar:2.0-beta4:compile
      [INFO]    org.apache.logging.log4j:log4j-core:jar:2.0-beta4:compile
      [INFO]    org.aspectj:aspectjrt:jar:1.7.2:compile
      [INFO]    org.aspectj:aspectjweaver:jar:1.7.2:compile
      [INFO]    org.bouncycastle:bcmail-jdk14:jar:1.38:compile
      [INFO]    org.bouncycastle:bcprov-jdk14:jar:1.38:compile
      [INFO]    org.bouncycastle:bctsp-jdk14:jar:1.38:compile
      [INFO]    org.codehaus.castor:castor:jar:1.2:compile
      [INFO]    org.dbunit:dbunit:jar:2.4.9:test
      [INFO]    org.hamcrest:hamcrest-core:jar:1.3:compile
      [INFO]    org.hibernate:hibernate-core:jar:4.2.0.CR1:compile
      [INFO]    org.hibernate:hibernate-entitymanager:jar:4.2.0.CR1:compile
      [INFO]    org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
      [INFO]    org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
      [INFO]    org.hsqldb:hsqldb:jar:2.2.9:test
      [INFO]    org.jasig.cas.client:cas-client-core:jar:3.1.12:compile
      [INFO]    org.javassist:javassist:jar:3.15.0-GA:compile
      [INFO]    org.jboss.logging:jboss-logging:jar:3.1.2.GA:compile
      [INFO]    org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.1.Final:compile
      [INFO]    org.openid4java:openid4java-nodeps:jar:0.9.6:compile
      [INFO]    org.projectlombok:lombok:jar:0.11.6:compile
      [INFO]    org.slf4j:jcl-over-slf4j:jar:1.7.1:runtime
      [INFO]    org.slf4j:slf4j-api:jar:1.6.1:compile
      [INFO]    org.slf4j:slf4j-log4j12:jar:1.7.2:compile
      [INFO]    org.springframework:spring-aop:jar:3.2.2.RELEASE:compile
      [INFO]    org.springframework:spring-aspects:jar:3.2.2.RELEASE:compile
      [INFO]    org.springframework:spring-beans:jar:3.2.2.RELEASE:compile
      [INFO]    org.springframework:spring-context:jar:3.2.2.RELEASE:compile
      [INFO]    org.springframework:spring-context-support:jar:3.2.2.RELEASE:compile
      [INFO]    org.springframework:spring-core:jar:3.2.2.RELEASE:compile
      [INFO]    org.springframework:spring-expression:jar:3.2.2.RELEASE:compile
      [INFO]    org.springframework:spring-jdbc:jar:3.2.2.RELEASE:compile
      [INFO]    org.springframework:spring-orm:jar:3.2.2.RELEASE:compile
      [INFO]    org.springframework:spring-test:jar:3.2.2.RELEASE:compile
      [INFO]    org.springframework:spring-tx:jar:3.2.2.RELEASE:compile
      [INFO]    org.springframework:spring-web:jar:3.2.0.BUILD-SNAPSHOT:compile
      [INFO]    org.springframework.data:spring-data-commons:jar:1.5.0.RELEASE:compile
      [INFO]    org.springframework.data:spring-data-jpa:jar:1.3.0.RELEASE:compile
      [INFO]    org.springframework.ldap:spring-ldap-core:jar:1.3.1.RELEASE:compile
      [INFO]    org.springframework.security:spring-security-acl:jar:3.2.0.M1:compile
      [INFO]    org.springframework.security:spring-security-aspects:jar:3.2.0.M1:compile
      [INFO]    org.springframework.security:spring-security-cas:jar:3.2.0.M1:compile
      [INFO]    org.springframework.security:spring-security-config:jar:3.2.0.M1:compile
      [INFO]    org.springframework.security:spring-security-core:jar:3.2.0.M1:compile
      [INFO]    org.springframework.security:spring-security-crypto:jar:3.2.0.M1:compile
      [INFO]    org.springframework.security:spring-security-ldap:jar:3.2.0.M1:compile
      [INFO]    org.springframework.security:spring-security-openid:jar:3.2.0.M1:compile
      [INFO]    org.springframework.security:spring-security-remoting:jar:3.2.0.M1:compile
      [INFO]    org.springframework.security:spring-security-web:jar:3.2.0.M1:compile
      [INFO]    org.swinglabs:pdf-renderer:jar:1.0.5:compile
      [INFO]    xml-apis:xml-apis:jar:1.0.b2:compile

      Comment


      • #4
        maven dependency:tree -Dverbose outputs:

        Code:
        [INFO] \- org.springframework.data:spring-data-jpa:jar:1.3.0.RELEASE:compile
        [INFO]    +- org.springframework.data:spring-data-commons:jar:1.5.0.RELEASE:compile
        [INFO]    |  +- (org.springframework:spring-core:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
        [INFO]    |  +- (org.springframework:spring-beans:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
        [INFO]    |  +- (org.slf4j:slf4j-api:jar:1.7.1:compile - omitted for conflict with 1.6.1)
        [INFO]    |  \- (org.slf4j:jcl-over-slf4j:jar:1.7.1:runtime - omitted for duplicate)
        [INFO]    +- (org.springframework:spring-orm:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
        [INFO]    +- (org.springframework:spring-context:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
        [INFO]    +- (org.springframework:spring-aop:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
        [INFO]    +- (org.springframework:spring-tx:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
        [INFO]    +- (org.springframework:spring-beans:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
        [INFO]    +- (org.springframework:spring-core:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
        [INFO]    +- org.aspectj:aspectjrt:jar:1.7.2:compile (version managed from 1.7.1)
        [INFO]    +- (org.slf4j:slf4j-api:jar:1.7.1:compile - omitted for conflict with 1.6.1)
        [INFO]    \- org.slf4j:jcl-over-slf4j:jar:1.7.1:runtime
        [INFO]       \- (org.slf4j:slf4j-api:jar:1.7.1:runtime - omitted for conflict with 1.6.1)

        Comment


        • #5
          Any chance you run your tests against the latest 1.3.2.RELEASE and post the complete exception?

          Comment


          • #6
            Originally posted by Oliver Gierke View Post
            Any chance you run your tests against the latest 1.3.2.RELEASE and post the complete exception?


            Hi Oliver,

            thanks for taking time to help me...

            pom's dependency basculated to "1.3.2.RELEASE"

            Code:
            	<dependency>
              		<groupId>org.springframework.data</groupId>
              		<artifactId>spring-data-jpa</artifactId>
              		<version>1.3.2.RELEASE</version>
              	</dependency>
            same problem occuring...

            here's the full exception

            Code:
            [ERROR][TestContextManager] Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@52a947eb] to prepare test instance [com.test.model.ServiceTestData@26419cb3]
            java.lang.IllegalStateException: Failed to load ApplicationContext
            	at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99)
            	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:122)
            	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
            	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
            	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:312)
            	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
            	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
            	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
            	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:284)
            	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
            	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
            	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
            	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
            	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
            	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
            	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
            	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
            	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
            	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
            	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
            	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
            	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
            	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
            	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
            	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
            	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
            Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'accrualsDeferralsBusiness' defined in file [C:\java\workspace-juno\Services\target\classes\com\business\bo\AccrualsDeferralsBusiness.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [com.services.dao.repository.IAccrualsDeferralsRepository]: : No qualifying bean of type [com.services.dao.repository.IAccrualsDeferralsRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=iAccrualsDeferralsRepository)}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.services.dao.repository.IAccrualsDeferralsRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=iAccrualsDeferralsRepository)}
            	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
            	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
            	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1051)
            	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:955)
            	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490)
            	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
            	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
            	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
            	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
            	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
            	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
            	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
            	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
            	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:120)
            	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
            	at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:100)
            	at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:248)
            	at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContextInternal(CacheAwareContextLoaderDelegate.java:64)
            	at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:91)
            	... 25 more
            Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.services.dao.repository.IAccrualsDeferralsRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=iAccrualsDeferralsRepository)}
            	at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:986)
            	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:856)
            	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:768)
            	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
            	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
            	... 43 more
            [DEBUG][DirtiesContextTestExecutionListener] After test class: context [[TestContext@1d48085 testClass = ServiceTestData, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@1d96bf64 testClass = ServiceTestData, locations = '{classpath:/com�test/applicationContext-JPAData.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]]], dirtiesContext [false].
            thx once again for your concern...


            i42

            Comment


            • #7
              Can you share a bit more information?

              1. What does the repository definition look like? (type signature is enough)
              2. What does the injection point look like? (read: the point where you're trying to inject the repo into)
              3. What does you repo bootraps config look like? XML? JavaConfig?
              4. How does your test case bootstrap the application?

              It might make sense to try to create a dedicated test case, e.g. a test case that only bootstraps the repository layer and tries to access the repository through @Autowired or the like. If this still fails, we might need to look into the project itself but I feel like there's some misconfiguration somewhere.

              Comment


              • #8
                1) Repository definition

                XML def:

                <jpa:repositories base-package="com.services.dao.repository" factory-class="com.services.dao.util.CustomRepositoryFacto ryBean" />


                Repositories are:

                - (standardly) built through :

                protected Object getTargetRepository(RepositoryMetadata metadata)
                -> return new AbstractRepositoryDAO<T, I> ((Class<T>) metadata.getDomainType(), entityManager);


                - extending:

                public class AbstractRepositoryDAO<T, ID extends Serializable> extends SimpleJpaRepository<T, ID> implements IRepositoryDAO<T, ID>, IPersistanceConstants

                (this class provides numerous additional functionnal DAO methods...)


                2) Injection point

                All business objects', referencing Repositories, are extending AbstractBusinessBO

                public class AbstractBusinessBO<T, DAO extends IRepositoryDAO<T, ID>, ID extends Serializable> implements IBusinessBO<T, DAO, ID>
                {
                @Getter @Setter
                private DAO dao;

                public AbstractBusinessBO(DAO dao) {setDao(dao);}


                The dao instance is provided and set in constructor...

                ex:

                @Service()
                public class AccrualsDeferralsBusiness extends AbstractBusinessBO<AccrualsDeferrals, IAccrualsDeferralsRepository, Integer> implements IAccrualsDeferralsBusiness, Serializable
                {
                @Autowired
                public AccrualsDeferralsBusiness(@Qualifier("iAccrualsDef erralsRepository") IAccrualsDeferralsRepository dao) {super(dao);}
                }


                and the repository definition:

                public interface IAccrualsDeferralsRepository extends IRepositoryDAO<AccrualsDeferrals, Integer>


                I strongly insist on the fact that this chain is 100% proof and working with the 1.2.0 Release... (dozens of test classes have been running for months)

                so I can affirm the design is not in cause/charge of the issue...


                3) repo bootraps config

                XML, a single line provided at the beginning of this post


                4) test case bootstrap

                @RunWith(SpringJUnit4ClassRunner.class)
                @ContextConfiguration(locations = {"../applicationContext-JPAData.xml"})
                public class ServiceTestData


                Very important !!! :

                In my Test class, I'm NOT referencing the specific "IAccrualsDeferralsRepository" mentionned on the exception stack trace !!!

                In my (humble) opinion, this bean injection is done when Spring Context is initializing and prototyping the population of candidates objets accessible and to be furtherly called during runtime,

                and it fails on the first one (the AccrualsDeferralsBusiness object, referencing the Repository, has its name starting with an "A"), probably because of a consistency problem inside the Context.


                So that's why I strongly believe the problem comes from a transversal situation (like the maven conf), and not from a specific implementation, once again, pom Spring Data artifact declaring 1.2.0.RELEASE makes everything running OK, and moving to 1.3.2.RELEASE makes it fail...

                Sincerely


                i42

                Comment


                • #9
                  when comparing maven dependency tree on spring data between both version

                  1.2.0.RELEASE

                  Code:
                  [INFO] \- org.springframework.data:spring-data-jpa:jar:1.2.0.RELEASE:compile
                  [INFO]    +- org.springframework.data:spring-data-commons-core:jar:1.4.0.RELEASE:compile
                  [INFO]    |  +- (org.springframework:spring-core:jar:3.1.2.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    |  \- (org.springframework:spring-beans:jar:3.1.2.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    +- (org.springframework:spring-orm:jar:3.1.2.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    +- (org.springframework:spring-context:jar:3.1.2.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    +- (org.springframework:spring-aop:jar:3.1.2.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    +- (org.springframework:spring-tx:jar:3.1.2.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    +- (org.springframework:spring-beans:jar:3.1.2.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    +- (org.springframework:spring-core:jar:3.1.2.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    +- (org.slf4j:slf4j-api:jar:1.6.1:compile - omitted for duplicate)
                  [INFO]    +- org.slf4j:jcl-over-slf4j:jar:1.6.1:runtime
                  [INFO]    |  \- (org.slf4j:slf4j-api:jar:1.6.1:runtime - omitted for duplicate)
                  [INFO]    \- org.aspectj:aspectjrt:jar:1.6.12:compile

                  1.3.2.RELEASE

                  Code:
                  [INFO] \- org.springframework.data:spring-data-jpa:jar:1.3.2.RELEASE:compile
                  [INFO]    +- org.springframework.data:spring-data-commons:jar:1.5.1.RELEASE:compile
                  [INFO]    |  +- (org.springframework:spring-core:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    |  +- (org.springframework:spring-beans:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    |  +- (org.slf4j:slf4j-api:jar:1.7.1:compile - omitted for conflict with 1.6.1)
                  [INFO]    |  \- (org.slf4j:jcl-over-slf4j:jar:1.7.1:runtime - omitted for duplicate)
                  [INFO]    +- (org.springframework:spring-orm:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    +- (org.springframework:spring-context:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    +- (org.springframework:spring-aop:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    +- (org.springframework:spring-tx:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    +- (org.springframework:spring-beans:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    +- (org.springframework:spring-core:jar:3.1.4.RELEASE:compile - omitted for conflict with 3.2.2.RELEASE)
                  [INFO]    +- org.aspectj:aspectjrt:jar:1.7.2:compile
                  [INFO]    +- (org.slf4j:slf4j-api:jar:1.7.1:compile - omitted for conflict with 1.6.1)
                  [INFO]    \- org.slf4j:jcl-over-slf4j:jar:1.7.1:runtime
                  [INFO]       \- (org.slf4j:slf4j-api:jar:1.7.1:runtime - omitted for conflict with 1.6.1)
                  except concerning the slf4j loggers, that i do not believe implicated in this issue, the only difference can be the org.aspectj:aspectjrt library... which is responsible for the repositories proxies, right ?

                  Comment


                  • #10
                    Okay, thanks for the detailed report. I just wanted to make sure we don't stumble over something obvious here. A few more questions:

                    1. Could please turn on DEBUG logging for the org.springframework.data package and list the output of those lines here?
                    2. What's the reason you do a qualified injection? Does the injection work without the qualifier?

                    I am explicitly asking for the @Qualifier annotation as using it effectively turns the "by type" injection into a "by name" injection. In Spring Data Commons 1.5.0 we introduced the ability to customize the bean name to be used for repositories using @Repository on the repository interface. If you e.g. had @Repository("foo") on the interface the bean name before 1.5.0 still was derived from the interface name. As of 1.5.0, the bean name will be "foo". This might cause a qualified injection to fail. Is that maybe the case for you?

                    Cheers,
                    Ollie

                    Comment


                    • #11
                      Originally posted by Oliver Gierke View Post
                      Okay, thanks for the detailed report. I just wanted to make sure we don't stumble over something obvious here. A few more questions:
                      Of course, no worries...

                      I recognize my original post was initially to much details lightweighted....


                      Originally posted by Oliver Gierke View Post

                      1. Could please turn on DEBUG logging for the org.springframework.data package and list the output of those lines here?
                      Having more than 300 hundreds repositories (and number still growing... yes we love your framework ), it would have taken too much place to post...

                      so I've made you a digest global trace (with little but important spring core additionnals lines), with the spring data debug traces focused on a single Entity Type, escaping the unnecessary iteration over the whole domain/model->Business->Repository instances

                      PLEASE BEFORE DIGGING THIS TRACE, READ NEXT POINT
                      (as a part of the solution has appeared/emerged while modifying the Qualifier...)


                      here it is:

                      Code:
                      [DEBUG][org.springframework.data.repository.config.RepositoryComponentProvider] Identified candidate component class: file [C:\java\workspace-juno\Services\target\classes\com\services\dao\repository\IAccrualsDeferralsRepository.class]
                      [DEBUG][org.springframework.data.repository.config.RepositoryBeanDefinitionParser] Registering repository: IClientRepository - Interface: com.services.dao.repository.IClientRepository - Factory: org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean
                      [DEBUG][org.springframework.data.repository.config.RepositoryBeanDefinitionParser] Registering repository: IAccrualsDeferralsRepository - Interface: com.services.dao.repository.IAccrualsDeferralsRepository - Factory: org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean
                      
                      [DEBUG][org.springframework.beans.factory.xml.XmlBeanDefinitionReader] Loaded 1179 bean definitions from location pattern [classpath:/com/test/applicationContext-JPAData.xml]
                      [INFO][org.springframework.context.support.GenericApplicationContext] Refreshing [email protected]00894: startup date [Thu May 30 14:50:04 CEST 2013]; root of context hierarchy
                      [DEBUG][org.springframework.context.support.GenericApplicationContext] Bean factory for [email protected]00894: org.springframework.beans.factory.support.DefaultListableBeanFactory@40d8b2eb: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor, accrualsDeferralsBusiness, IAccrualsDeferralsRepository,  org.springframework.data.repository.core.support.RepositoryInterfaceAwareBeanPostProcessor#0,org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0,dataSource,entityManagerFactory,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,]; root of factory hierarchy
                      
                      
                      [DEBUG][org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating shared instance of singleton bean 'accrualsDeferralsBusiness'
                      [DEBUG][org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'accrualsDeferralsBusiness'
                      [DEBUG][org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
                      [INFO][org.springframework.beans.factory.support.DefaultListableBeanFactory] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@40d8b2eb: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,accrualsDeferralsBO, accrualsDeferralsBusiness, accrualsDeferralsDAO, accrualsDeferralsElementDAO, IAccrualsDeferralsRepository, org.springframework.data.repository.core.support.RepositoryInterfaceAwareBeanPostProcessor#0,org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0,dataSource,entityManagerFactory,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
                      [DEBUG][org.springframework.orm.jpa.EntityManagerFactoryUtils] Closing JPA EntityManager

                      Comment


                      • #12
                        we can see:

                        - The 3 first lines starting spring-data on IAccrualsDeferralsRepository target
                        - The spring core holding in its defined bean array the accrualsDeferralsBusiness, IAccrualsDeferralsRepository instances

                        but when trying to build the business instance ("Creating instance of bean 'accrualsDeferralsBusiness'"), the global spring context is destroyed... (no further explanation, even in log level="all" )



                        Originally posted by Oliver Gierke View Post

                        2. What's the reason you do a qualified injection? Does the injection work without the qualifier?
                        quickly:

                        I've done it long time ago (about 6 month, on a previous implementation without Spring Data...)

                        initially the AbstractBusiness was refering an IDAO<T>, (and not a specific DAO genericly typed info, as in the 2nd implementation, the one I've forwarded you)

                        the injection being done at runtime, the spring context was not able to select an appropriate IDAO inside the list of all IDAOs constructed,

                        and the very first solution I founded (before thinking using a Type policy) was to use a name qualifier, keeping the constructor parameter as an abstract IDAO (and not an IAccrualsDeferralsDAO)

                        Code:
                        -> public AccrualsDeferralsBO(@Qualifier("accrualsDeferralsDAO") IDAO dao) {super(dao);}
                        (previous implementation)

                        So when I moved to the second version of the backend services, I've kept this name/qualifier policy, even if the constructor param type is now a fully qualified with Type

                        Code:
                        public AccrualsDeferralsBusiness(@Qualifier("iAccrualsDeferralsRepository") IAccrualsDeferralsRepository dao) {super(dao);}
                        WOOOOOOOAHHH !!!!!!!!!!!!!

                        when I remove the @Qualifier from the constructor signature, the concerned object is not anymore in conflict when assembled by Spring context...

                        I still got the problem on the others class (not corrected), so I can not say right now the issue is 100% resolved, but it is a very significant progress, for sure !!!




                        Originally posted by Oliver Gierke View Post

                        I am explicitly asking for the @Qualifier annotation as using it effectively turns the "by type" injection into a "by name" injection. In Spring Data Commons 1.5.0 we introduced the ability to customize the bean name to be used for repositories using @Repository on the repository interface. If you e.g. had @Repository("foo") on the interface the bean name before 1.5.0 still was derived from the interface name. As of 1.5.0, the bean name will be "foo". This might cause a qualified injection to fail. Is that maybe the case for you?
                        actually, my Repositories has NO @nnotations, and looks this way:

                        Code:
                        public interface IAccrualsDeferralsRepository extends IRepositoryDAO<AccrualsDeferrals, Integer>
                        its refering father interface is typed this way:

                        Code:
                        @NoRepositoryBean
                        public interface IRepositoryDAO<T, ID extends Serializable> extends IDAO<T>, JpaRepository<T, ID>, JpaSpecificationExecutor<T>
                        (as its is built with a specific Factory... previously mentionned)


                        so now the big question is

                        - WHY does the constructor signature using the of @Qualifier("iAccrualsDeferralsRepository") + a typed parameter IAccrualsDeferralsRepository fails in 1.3.*.RELEASE ?

                        Code:
                        @Service()
                        public class AccrualsDeferralsBusiness extends AbstractBusinessBO<AccrualsDeferrals, IAccrualsDeferralsRepository, Integer> implements IAccrualsDeferralsBusiness, Serializable
                        {
                        	@Autowired
                        	//public AccrualsDeferralsBusiness(@Qualifier("iAccrualsDeferralsRepository") IAccrualsDeferralsRepository dao) {super(dao);} //NOK
                        	public AccrualsDeferralsBusiness(IAccrualsDeferralsRepository dao) {super(dao);} //OK
                        }
                        may be because the resolution is done by the conjunction of both... ?!?!

                        so we have (as far as I've seen...)

                        - a bean called "iAccrualsDeferralsRepository" (by default as no name override has been provided... and I don't think you've changed the default Spring core naming - first letter in lowCase),

                        - and its type correctly being IAccrualsDeferralsRepository

                        so why in Spring data 1.2.0 this bean is correctly found in the context, and it is not in Spring data 1.3.0 ??????????

                        Oliver... it's your turn...
                        Last edited by impakt42; May 30th, 2013, 10:33 AM.

                        Comment


                        • #13
                          Hi Oliver,

                          I've removed all (300) @Qualifier for repositories injection, and the Spring context is not anymore in failure... my tests are back working again !!!

                          So I think, very objectively, we have identified an important issue on Repositories concerning "Spring injection by name strategy"... do you want me to open a bug ticket on the jira for you...

                          thanx for everything Oliver, I would have never figure this thing out without your precious help...

                          If you ever come to Paris, I owe you (at least) a beer...

                          sincerely


                          Dimitri42

                          Comment


                          • #14
                            Here's the story: with the feature introduced we moved away from our hardcoded StringUtils.uncapitalize(…) to reuse Spring's AnnotationBeanNameGenerator. This one in turn uses Java's Introspector.uncapitalize(…) which has some weird rules about decapitalizing strings that start with multiple uppercase letters (see [0]).

                            So I'd argue everything works as expected as we essentially align with the way Spring framework defaults bean names. Still, I also have been caught by surprise a bit. I definitely recommend not to use qualifiers if there's no need to as its superfluous on the one hand and you essentially turn autowiring by type into autowiring by name, which breaks by definition as soon as you start e.g. renaming classes etc.

                            Cheers,
                            Ollie

                            PS: I'll be at the Paris Spring User Group on Thursday next week. Would be happy to see you in person there .

                            [0] http://docs.oracle.com/javase/7/docs...a.lang.String)

                            Comment


                            • #15
                              Hey,

                              ok, maybe opening a ticket is overscaled for this small problem, which doesn''t need furthermore correction on your side...

                              But as I've experienced such a problem, may be/probably others will, so I recommend you include, inside your >= 1.3.x library release note, a small information point on this nomenclature/naming policy migration, (which is indeed quite an easy task to do and can save time...

                              I agree on the injected by type... the injected by name was in my case a scoria from the previous architecture version.

                              French Cheesy cheerz man !!!

                              Dimitri42

                              PS: I would have loved to be there thursday, but I'll be at the Bonobo Live concert that evening, and switching to a dev party is definitely not an acceptable/possible option

                              http://ninjatune.net/artist/bonobo

                              Comment

                              Working...
                              X