일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- 1110
- X보다 작은 수
- 함수 사용하기
- 블록 체인
- 세 수
- Dapp
- Baekjoon
- 가상 화폐
- 10817
- 자바스크립트
- 별 찍기 - 11
- 비트 코인
- 솔리디티
- 1065
- 평균은 넘겠지
- Mist
- 더하기 사이클
- 단계별로 풀어보기
- 10871
- 1546
- 2448
- if문 사용해보기
- for문 사용해보기
- 알고리즘 문제풀이
- 이더리움
- 1%d
- 백준
- 그대로 출력하기
- 시험 성적
- Remix
- Today
- Total
블링블링 범블링
STS_pom_설정_mybatis_연동 - root-context.xml 본문
root-context.xml
<?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:mybatis-spring="http://mybatis.org/schema/mybatis-spring"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://mybatis.org/schema/mybatis-spring http://mybatis.org/schema/mybatis-spring-1.2.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.3.xsd">
<!-- 5. 스프링 빈 등록하기 위해서 추가 -->
<context:component-scan base-package="*"></context:component-scan>
<!-- 1. DataSource 설정추가하고 JUnit 연결 테스트하기 -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
<property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:xe"></property>
<property name="username" value="hr"></property>
<property name="password" value="1111"></property>
</bean>
<!-- 2. MyBatis 연동을 위한 추가 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- 3. resource에 mybatis-config.xml 만들고 추가하기 -->
<property name="configLocation" value="classpath:mybatis-config.xml" />
<!-- 4. resource에 mappers 디렉토리를 만들고 추가하기 mybatis dqm -->
<property name="mapperLocations" value="classpath:mappers/**/*Mapper.xml" />
</bean>
<!-- 6. @repository 에서 의존성 주입을 위한 설정 -->
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate" destroy-method="clearCache">
<constructor-arg name="sqlSessionFactory" ref="sqlSessionFactory"></constructor-arg>
</bean>
</beans>
'Technology > 프레임워크' 카테고리의 다른 글
SPRING SAMPLE CODE (0) | 2018.07.16 |
---|---|
spring - STS_pom_설정_mybatis_연동 - pom.xml (0) | 2018.07.12 |
Spring 개요 (0) | 2018.07.12 |