이글루스 | 로그인  



spring 에 cglib 를 사용, aop 사용할때 에러

아래와 같은 에러가 junit 로 테스트 할때 발생해서 하루종일.. 찾다가 못 찾아서
우리 회사 괴물(고수)에게 물어 봤더니...
cglib를 사용할때의 버그라고 했다.

<aop:config proxy-target-class="true">
  <aop:advisor pointcut="execution(* dao.*.*(..))" advice-ref="txAdvice"/>
 </aop:config>

proxy-target-class="true" 옵션을 적용해 줘야 에러가 나지 않는다

org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy0] to required type [dao.UserDao] for property 'userDao'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy0] to required type [dao.UserDao] for property 'userDao': no matching editors or conversion strategy found
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy0] to required type [dao.UserDao] for property 'userDao': no matching editors or conversion strategy found
 at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
 at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
 at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:380)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1105)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:273)
 at org.springframework.test.AbstractDependencyInjectionSpringContextTests.injectDependencies(AbstractDependencyInjectionSpringContextTests.java:179)
 at org.springframework.test.AbstractDependencyInjectionSpringContextTests.prepareTestInstance(AbstractDependencyInjectionSpringContextTests.java:158)
 at org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:88)
 at junit.framework.TestCase.runBare(TestCase.java:128)
 at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
 at junit.framework.TestResult$1.protect(TestResult.java:110)
 at junit.framework.TestResult.runProtected(TestResult.java:128)
 at junit.framework.TestResult.run(TestResult.java:113)
 at junit.framework.TestCase.run(TestCase.java:120)
 at junit.framework.TestSuite.runTest(TestSuite.java:228)
 at junit.framework.TestSuite.run(TestSuite.java:223)
 at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

by 나림 | 2007/09/10 13:25 | spring | 트랙백 | 덧글(3)

트랙백 주소 : http://gt1000.egloos.com/tb/733595
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]
Commented by 가릉가릉 at 2009/07/03 09:53
좋은 자료 담아갑니다. ^^
Commented by Kangsan at 2010/01/30 15:11
아.. 감사합니다.. 이거 때문에 한참 헤맸어요 ;;
Commented by 끄악 at 2010/02/03 16:24
ㄳㄳ요 ㅠㅠ 이것땜에 완전 삽질 중였는데 ㅠㅠ

:         :

:

비공개 덧글

◀ 이전 페이지          다음 페이지 ▶