본문 바로가기

웹개발 셋팅

dispatcher-servlet.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:aop="http://www.springframework.org/schema/aop"

xmlns:context="http://www.springframework.org/schema/context"

xmlns:p="http://www.springframework.org/schema/p"

xmlns:util="http://www.springframework.org/schema/util"

xmlns:task="http://www.springframework.org/schema/task"

xmlns:security="http://www.springframework.org/schema/security"

xsi:schemaLocation="

    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd

http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd

http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd

http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd

        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd

        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">           

 <!-- 어노테이션 사용 설정, scoped-proxy="no" 프록시를 생성하지 않을 경우 설정(기본:no) -->

 <!-- <context:component-scan> 태그를 이용하여 @Controller 등의 어노테이션을 적용한 클래스를 자동으로 로딩. -->

<context:component-scan base-package="*" />

 <!-- <context:component-scan base-package="*" scoped-proxy="no"/> -->

 <!-- 시큐리티 어노테이션 적용 -->

  <security:global-method-security proxy-target-class="true" secured-annotations="enabled" pre-post-annotations="enabled" jsr250-annotations="enabled" />


 <!-- 어노테이션을 이용한  컨트롤러 등록 -->

<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"

           p:alwaysUseFullPath="true">

<property name="order" value="1"></property>

</bean>

 

<!-- 타일즈 환경 설정 -->

    <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">

       <property name="definitions">

           <list>

               <value>/WEB-INF/tiles-defs.xml</value>

           </list>

       </property>

    </bean>

    

<!-- Commander의 처리 결과를 보여줄 View를 결정한다.  

첫번째 bean은 타일즈 설정에 의한 viewResolver, 

두번째 bean은 타일즈 설정에 의한 뷰가 아닌 통째로 불러올 때 사용 보통 팝업을 이용한 뷰처리시 사용했다.

property name="order"의 value값에 의해서 어떤 뷰를 먼저 대입해서 보여줄지 우선순위를 설정한다.

-->

<bean id="tilesViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">

<property name="order" value="1" />

<property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView" />

<property name="viewNames">

<list>

<value>.*</value><!-- tiles-defs.xml에서 설정한 <definition name=".mainLayout" .. 의 name값을 토대로 다 설정해야함.

name 값이 admin.adminLayout 것이 있다면 <value>admin.*</value> 을 설정해 놓는다.-->

</list>

</property>

</bean>

<bean id="viewResolver2" class="org.springframework.web.servlet.view.InternalResourceViewResolver">

<property name="order" value="2" />

<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />

<property name="prefix" value="/WEB-INF/views/" />

<property name="suffix" value=".jsp" />

</bean>


<!-- 파일 업로드 -->

    <bean id="multipartResolver"  class="org.springframework.web.multipart.commons.CommonsMultipartResolver">

         <property name="maxUploadSize" value="10485760" />

    </bean>

    

<!-- 로그처리 -->

     <aop:aspectj-autoproxy />

     <bean class="com.sp.log.LogAspect"/>


<!-- 예외처리 -->

    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver">

        <property name="order" value="1" />

     </bean>

    <bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">

        <property name="order" value="2" />

        <property name="exceptionMappings">

            <props>

                <prop key="org.springframework.web.multipart.MaxUploadSizeExceededException">.error.fileuploadFailure</prop>

                <prop key="org.springframework.dao.DataAccessException">.error.dataAccessFailure</prop>

                <prop key="defaultErrorView">.error.error</prop>

            </props>

        </property>

         <property name="warnLogCategory" value="ERROR"/>   <!-- 로그기록 -->

    </bean>


    

 </beans>  



'웹개발 셋팅' 카테고리의 다른 글

log4j를 이용하여 쿼리 로그 보기(콘솔에서)  (0) 2014.01.22
maybatis-config & mapper 설정  (0) 2014.01.22
security-context.xml  (0) 2013.11.27
root-context.xml (applicationContext.xml)  (0) 2013.11.27
web.xml  (0) 2013.11.27