Announcement Announcement Module
Collapse
No announcement yet.
AOP Unit test not working Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AOP Unit test not working

    I have created spring aop files


    File 1 - test-core-spring-beans.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...ring-beans.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-3.0.xsd
    http://www.springframework.org/schema/jdbc http://www.springframework.org/schem...pring-jdbc.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

    <aop:aspectj-autoproxy proxy-target-class = "false" />

    <!--
    | Framework core
    +-->
    <context:component-scan base-package="com.xx.dg">
    <context:include-filter type="annotation" expression="org.springframework.stereotype.Compone nt" />
    </context:component-scan>

    <!--
    | Core, Subsystems and DAOs
    +-->
    <context:component-scan base-package="au.com.xx.dg">
    <context:include-filter type="annotation" expression="org.springframework.stereotype.Compone nt" />
    <context:include-filter type="annotation" expression="com.xx.dg.core.annotations.Subsystem" />
    <context:include-filter type="annotation" expression="com.xx.dg.core.annotations.DAO" />
    </context:component-scan>




    File 2 : test-bb-spring-beans.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <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:jdbc="http://www.springframework.org/schema/jdbc"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schem...pring-jdbc.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-3.0.xsd
    http://www.springframework.org/schema/task http://www.springframework.org/schem...g-task-3.0.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.5.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schem...g-util-3.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schem...ing-tx-2.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">


    <!--
    | Bancs
    +-->
    <bean id="bancsTemplate" class="au.com.xx.dg.dao.BancsTemplate">
    <constructor-arg ref="bancsConnectionFactory" />
    </bean>

    <bean id="bancsConnectionFactory" class="org.springframework.jca.support.LocalConnec tionFactoryBean">
    <property name="managedConnectionFactory" ref="managedBANCSConnectionFactory" />
    <property name="connectionManager" ref="defaultConnectionManager" />
    </bean>

    <bean id="managedBANCSConnectionFactory" class="au.com.xx.dg.jca.bancs.BANCSManagedConnecti onFactoryImpl">
    <property name="host" value="${${test.region}.bancs.host}" />
    <property name="port" value="${${test.region}.bancs.port}" />
    <property name="timeout" value="20000" />
    <property name="threadSleepTime" value="10" />
    <property name="byteBufferSize" value="3000" />
    </bean>

    <bean id="defaultConnectionManager" class="au.com.xx.dg.jca.base.DefaultConnectionMana ger" />

    </beans>



    If I remove the line "<aop:aspectj-autoproxy proxy-target-class = "false" /> " it all work fine but if I leave the line I get error

    Caused by: org.springframework.beans.factory.NoSuchBeanDefini tionException: No matching bean of type [au.com.xx.dg.dao.BancsTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Aut owired(required=true)}


    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: protected au.com.xx.dg.dao.BancsTemplate au.com.xx.dg.dao.DgwLegacyDaoSupport.bancsTemplate ; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No matching bean of type [au.com.xx.dg.dao.BancsTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Aut owired(required=true)}

    I need to get the aspectj AOP working, what could be causing the above error

    Thanks,
    Bhawna
Working...
X