1 Reply Latest reply: Apr 5, 2013 9:03 AM by gimbal2 RSS

    Is the <tx:annotation-driven /> configuration required ?

    1001310

      I use spring & mybatis in my web site project. I set data source configuration below.
      It can work. But the <tx:annotation-driven /> is required to enable @Transactional that is figured out at the spring book.
      Why don't I use this tag and it works well ?

      Regards,
      Steven


      <context:property-placeholder location="classpath:datasource.properties" />

      <bean id="dataSource"
      class="org.springframework.jdbc.datasource.DriverManagerDataSource"
      p:driverClassName="${jdbc.driverClassName}"
      p:url="${jdbc.url}"
      p:username="${jdbc.username}"
      p:password="${jdbc.password}"
      />

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

      <bean id="sqlSessionFactory"
      class="org.mybatis.spring.SqlSessionFactoryBean"
      p:configLocation="classpath:sqlMapClient.xml"
      p:dataSource-ref="dataSource"
      />

      <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"
      p:sqlSessionFactoryBeanName="sqlSessionFactory"
      p:basePackage="tw.idv.market.dao"
      />

      Edited by: 998307 on 2013/4/5 上午 6:46