No bean named 'transactionManager' available

2022. 2. 12. 19:00
반응형
<tx:annotation-driven />
<context:component-scan base-package="com.gyull.webnovel.aop"/>
<bean id="transactionManager"
  	class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<aop:aspectj-autoproxy></aop:aspectj-autoproxy>

먼저 디펜던시에 Spring-tx, AspectJ, AspectJWeaver가 있어야 하고,

root-context.xml에 DB 관련 설정이 다 되어있다면, 위의 내용만 더 추가해주면 된다

 

1. aop는 네임스페이스에서 체크해주어야 함

2. aop 패키지를 새로 추가하는 context:component-scan base-pakage의 주소에 넣어줄 것 

 

위의 에러는 transactionManager를 bean으로 등록하지 않아서 나는 에러이므로

<bean id="transactionManager" 
      class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource-Mysql"/>
</bean>

위의 과정을 다 했다면, root-context.xml의 안에 빈을 등록해주면 돌아갈 것이다.

 

 

 

반응형

BELATED ARTICLES

more