web-inf > spring > root-context.xlm

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?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"
    xsi:schemaLocation="http://mybatis.org/schema/mybatis-spring http://mybatis.org/schema/mybatis-spring-1.2.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.1.xsd">
 
<!--      bean 자바 객체
     id 변수명 class 자료형 -->
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName"
            value="oracle.jdbc.driver.OracleDriver" />
        <property name="url"
value="jdbc:oracle:thin:@localhost:1521/xe" />
        <property name="username" value="spring" />
        <property name="password" value="1234" />
    </bean>
 
 
 
    <bean id="sqlSessionFactory"
        class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <!-- mybatis 설정파일의 위치 -->
        <property name="configLocation"
            value="classpath:/mybatis-config.xml" />
            <!-- mybatis mapper 파일의 경로 
            와일드카드 /** 모든 하위디렉토리   * 모든 이름
            -->
        <property name="mapperLocations"
            value="classpath:mappers/**/*.xml" />
    </bean>
 
    <bean id="sqlSession"
        class="org.mybatis.spring.SqlSessionTemplate"
        destroy-method="clearCache">  <!-- auto close -->
        <constructor-arg name="sqlSessionFactory"
            ref="sqlSessionFactory" />
    </bean>
<mybatis-spring:scan
base-package="com.example.spring03"
</beans>
cs

'🏀Java > 🏀Pom.xml' 카테고리의 다른 글

pom.xml 파일업로드  (0) 2022.06.03
spring 레거시프로젝  (0) 2022.06.03
xml 파일 추가후 mybatis-config.xml  (0) 2022.06.02
mybatis-spring 연결  (0) 2022.06.02
mybaits sql 매퍼 프레임워크  (0) 2022.06.02