'application-context.xml'에 해당되는 글 1건

  1. 2014.10.15 applicationContext.xml 기본설정(WEB-INF/)
2014. 10. 15. 21:41




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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?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:aop="http://www.springframework.org/schema/aop"
    xmlns:jee="http://www.springframework.org/schema/jee" xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:websocket="http://www.springframework.org/schema/websocket"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
        http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd">
 
    <!-- @Controller, @Service -->
    <mvc:annotation-driven />
 
    <!-- jndi 설정 : Java Naming and Directory Interface -->
    <!-- jndi-name에서 "java:comp/env/여기 부분을 찾음  -->
    <!-- META-INF/context.xml에서 name의 값과 같음 -->
    <!-- WEB-INF/lib/ojdbc6.jar 파일 필요 -->
    <jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/oracle" />
    
    <!--  jndi 설정을 안하면 아래 코드로 작성 -->
    
    <!-- DataSource 설정 -->
    <!--  
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
    p:driverClassName="oracle.jdbc.OracleDriver"
    p:url="jdbc:oracle:thin:@localhost:1521:xe"
    p:username="test"
    p:password="1111"/>
    -->
 
    <!-- SqlSessionFactory 설정 -->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"
        p:dataSource-ref="dataSource" p:configLocation="WEB-INF/mybatis-config.xml" />
 
    <!-- SqlSessionTemplate 설정 -->
    <bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
        <constructor-arg ref="sqlSessionFactory" />
    </bean>
    <!-- 여기까지 기본셋팅 -->
 
    <!-- Bean DAO설정 --> 
    <!-- scope의 default는 싱글톤으로 만들어집니다. -->
    <bean scope="singleton" id="usersDAO" p:session-ref="sqlSession"
    class="com.pmi.lms.dao.UserDAOImpl"/>
    
    <!-- Bean Service설정 --> 
    <bean id="usersService" p:userDAO-ref="usersDAO"
    class="com.pmi.lms.service.UserServiceImpl"/>
    
    <!-- multipartResolver 설정(멀티파트,업로드처리) -->
    <bean id="multipartResolver" p:defaultEncoding="UTF-8"
        p:maxUploadSize="104857600"
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver" />
    
    <!-- util 설정 -->
    <bean id="rename" class="com.pmi.lms.util.FileRenameUtil"/>
    
</beans>
 

Colored By Color Scripter

Posted by 루피아빠