mybatis 빈설정

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


<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">

<property name="driverClassName" value="${jdbc.driverClassName}" />

<property name="url" value="${jdbc.url}" />

<property name="username" value="${jdbc.username}" />

<property name="password" value="${jdbc.password}" />

</bean>


<!-- <bean id="dataSource" class="net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy">

<constructor-arg ref="dataSourceSpied" />

</bean> -->


<bean id="SqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">

<property name="dataSource" ref="dataSource" />

<property name="configLocation" value="classpath:/mybatis/mybatis-config.xml" />

<property name="mapperLocations" value="classpath:/mybatis/mapper/**/*.xml" />

</bean>



<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate" destroy-method="clearCache">

<constructor-arg name="sqlSessionFactory" ref="SqlSessionFactory" />

</bean>


<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

<property name="dataSource" ref="dataSource" />

</bean>


<tx:annotation-driven transaction-manager="transactionManager" />

'프로그래밍 > Spring' 카테고리의 다른 글

DispatcherServlet 설정  (0) 2019.01.03
Java Cofig 설정 1편  (0) 2018.12.07
로그인 예제  (0) 2018.07.13
RSA 암호화 예제 2  (0) 2018.07.13
File 읽고 데이터 삽입하기 예제  (0) 2018.07.05
TAGS.

Comments