<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:p="http://www.springframework.org/schema/p"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
           http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
           http://www.springframework.org/schema/aop
           http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
           http://www.springframework.org/schema/tx
           http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

   <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
   p:dataSource-ref="dataSource" />
   <tx:annotation-driven transaction-manager="transactionManager"/>

하루동안 삽질했다. 스프링으로 트랜잭션을 간단히 처리할 수 있다길래 금방 되겠지 싶었는데... 뜻하지 않은 톰캣 오류..
그 [심각]말이다.. 정말 심각했다. 도통 답이 나오지 않았다...
그렇게 포기할 무렵... DAO단@Transaction을 선언해준 메소드가 있었는데 이 선언을 지우고 실행하니까 되더라니..
설마 클래스파일의 어노테이션까지 톰캣이 캐싱할 줄은 몰랐는데..;; 이건 전혀 예상밖이었다.
문제는... DAO단에 직접 트랜잭션을 선언한 것... 액션단부터 가지고 오는 정보가 없으니까 에러가 난 것이다.
Action클래스에 선언해주니 깔끔하게 성공했다.
다른 방법도 있었다..advice를 이용한 것

 <tx:advice id="txAdvice" transaction-manager="transactionManager">
  <tx:attributes>
   <tx:method name="categoriesCopy" propagation="REQUIRED"/>
  </tx:attributes>
 </tx:advice>
 <aop:config>
  <aop:pointcut expression="execution(* career.dao.category.*.*(..))" id="servicePublicMethod"/>
  <aop:advisor advice-ref="txAdvice" pointcut-ref="servicePublicMethod"/>
 </aop:config>

 위에 aspectj표현식은 맞다. 하지만 대상이 잘못됬다.. 위의 어노테이션 선언처럼 액션단에 적용이 되야 한다.
그러므로..<aop:pointcut expression="execution(* career.action.*.*(..))" id="servicePublicMethod"/> 가 맞다.

이렇게 중요한 것을 배웠으니 나머지 트랜잭션과 관련된 옵션에 대해서는 책을 보고 공부하자.
아... 그리고 위에 aop를 쓰려거든 aspectJ관련 라이브러리들을 추가해 주어야 한다.
AND