I try to use cobertura maven plugin for coverage my simple spring 3.1 application.
But after run cobertura:cobertura, System show error.
My application ContextCode:Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.xxx.yyy.master.repository.CrsBranchHibernateRepository com.xxx.yyy.master.service.CrsBranchServiceImpl.crsBranchHibernateRepository; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.bigc.crs.master.repository.CrsBranchHibernateRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:506) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284)
i try to search in this forum and found someCode:<?xml version="1.0" encoding="UTF-8" standalone="no"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd" > <context:property-placeholder location="classpath*:META-INF/spring/*.properties"/> <context:spring-configured /> <context:component-scan base-package="com.xxx.yyy"> <context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation"/> </context:component-scan> <!-- Initial Data --> <jdbc:initialize-database data-source="dataSource" enabled="on" ignore-failures="DROPS"> <jdbc:script location="classpath*:META-INF/script/database/db-schema.sql"/> <jdbc:script location="classpath*:META-INF/script/database/db-test-data.sql"/> </jdbc:initialize-database> <bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource"> <property name="driverClassName" value="${oracle.database.driverClassName}"/> <property name="url" value="${oracle.database.url}"/> <property name="username" value="${oracle.database.username}"/> <property name="password" value="${oracle.database.password}"/> <property name="testOnBorrow" value="true"/> <property name="testOnReturn" value="true"/> <property name="testWhileIdle" value="true"/> <property name="timeBetweenEvictionRunsMillis" value="1800000"/> <property name="numTestsPerEvictionRun" value="3"/> <property name="minEvictableIdleTimeMillis" value="1800000"/> </bean> <bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory"/> </bean> <tx:annotation-driven mode="aspectj" transaction-manager="transactionManager" /> <bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory"> <property name="persistenceUnitName" value="persistenceUnit-test"/> <property name="dataSource" ref="dataSource"/> </bean> <!-- Repository Configure --> <jpa:repositories base-package="com.xxx.yyy" /> </beans>
My spring configuration doesn't has any code like this.Code:<context:annotation-config/> <aop:aspectj-autoproxy proxy-target-class="true" />
I try to put in my code but it's not work.
how can i do ?


Reply With Quote
