IT_Note

스프링 환경 설정파일


mvc-config.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:mvc="http://www.springframework.org/schema/mvc"

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"

xsi:schemaLocation="

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

   http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd

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

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

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

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


    <mvc:annotation-driven />


    <!-- / 매핑에서 정적 리소스(html, css, js등)를 처리할수있도록 설정  -->

<mvc:default-servlet-handler/>


<context:component-scan base-package="com.sp" />


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

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

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

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

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

</bean>

<!-- 

<mvc:view-resolvers>

<mvc:jsp prefix="/WEB-INF/view/" />

</mvc:view-resolvers>

 -->


</beans>






application-config.xml 

 스프링에서 공통적으로 사용되는 객체를 생성하기 위한 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:context="http://www.springframework.org/schema/context"

xsi:schemaLocation="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.xsd">

    

    <!-- 마이바티스 설정 파일 import ★-->

    <import resource="/../../mybatis/mybatis-context.xml"/>


</beans>