-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:context="http://www.springframework.org/schema/context" | ||
xmlns:mybatis-spring="http://mybatis.org/schema/mybatis-spring" | ||
xmlns:tx="http://www.springframework.org/schema/tx" | ||
xsi:schemaLocation="http://mybatis.org/schema/mybatis-spring http://mybatis.org/schema/mybatis-spring-1.2.xsd | ||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans-4.3.xsd | ||
http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context-4.3.xsd | ||
http://www.springframework.org/schema/tx https://www.springframework.org/schema/tx/spring-tx-4.3.xsd"> | ||
|
||
|
||
<!-- | ||
mybatis 5.x의 최소한의 요소만으로 DBMS 와 연동하기 위한 설정 | ||
--> | ||
|
||
<!-- 1 dataSource 생성, MySQL 8.x --> | ||
<bean id="ds" class="org.apache.commons.dbcp2.BasicDataSource"> | ||
<property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/> | ||
<property name="username" value="root"/> | ||
<property name="password" value="root_Password"/> | ||
<property name="url" value="jdbc:mysql://localhost:3306/bbsDB"/> | ||
</bean> | ||
|
||
<!-- 2. sqlSession을 관리할 관리자 생성 --> | ||
<!-- typeAliasesPackage : value로 설정된 패키지에 있는 모든 DTO, VO 클래스를 자동으로 Alias 등록 --> | ||
<!-- mapperLocation : xml 방식의 SQL mapper 경로 설정 --> | ||
<bean id="factoryBean" class="org.mybatis.spring.SqlSessionFactoryBean"> | ||
<property name="dataSource" ref="ds"/> | ||
<property name="typeAliasesPackage" value="com.callor.bbs.models"/> | ||
<property name="mapperLocations" value="/WEB-INF/spring/mapper/*-mapper.xml"/> | ||
</bean> | ||
|
||
<!-- mapper.xml과 Dao와 연동하여 DBMS 연산을 수행 --> | ||
<bean class="org.mybatis.spring.SqlSessionTemplate"> | ||
<constructor-arg index="0" ref="sqlSessionFactory" /> | ||
</bean> | ||
|
||
<!-- Dao interface 를 Scan 하여 실제 DBMS 핸들링 코드를 작성해 둔다 --> | ||
<mybatis-spring:scan base-package="com.callor.bbs.dao"/> | ||
|
||
<!-- Transaction 설정 --> | ||
<tx:annotation-driven/> | ||
<bean id="transactionManager" | ||
class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> | ||
<property name="dataSource" ref="ds"/> | ||
</bean> | ||
|
||
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters