Spring Framework
-
Spring MVC Controller에서 transaction이 적용되지 않는다. (Self-Invocation)Spring Framework 2019. 10. 11. 15:32
Spring 2.5 버전을 사용중인 프로젝트를 3.2 버전으로 마이그레이션하고 있었다. 모든 XML 기반 설정들을 Java 기반으로 변경하는 작업도 진행했는데, 이 XML 설정은 선언적 트랜잭션 설정도 포함하고 있었다. (CGLIB 사용) 다음과 같이 말이다. 아래는 Java config로 옮긴 모습이다. @Bean public TransactionInterceptor transactionInterceptor(DataSourceTransactionManager transactionManager) { return new TransactionInterceptor(transactionManager, transactionAttributeSource()); } @Bean public TransactionAttri..
-
Spring Framework 3.x 이하에서 CGLIB proxy 사용 시 에러Spring Framework 2019. 9. 20. 13:50
Spring AOP는 대상 객체를 프록시하기 위해 내부적으로 JDK dynamic proxy 또는 CGLIB를 사용한다. 대상이 최소 하나의 인터페이스를 구현한 객체라면 JDK dynamic proxy를 사용하고, 인터페이스를 구현하지 않은 객체라면 CGLIB proxy가 생성된다. Spring Framework 3.x 이하에서 CGLIB 사용 시 대상 객체가 constructor injection을 사용한다면 아래와 같은 에러가 발생한다. Could not generate CGLIB subclass of class: Common causes of this problem include using a final class or a non-visible class; nested exception is jav..