spring controller configuration

johon 13年前發布 | 2K 次閱讀

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd&gt;
        http://www.springframework.org/schema/mvc
        ;

<!-- 使用注解配置 --> <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>

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

<context:component-scan base-package="com.huawei.datavoice">
    <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>  
     <!-- 將Service注解給去掉  --> 
    <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service"/>             
</context:component-scan>
<context:annotation-config />

<!--  

<mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/**"/>

   </mvc:interceptor>

</mvc:interceptors>
-->

<!-- 配置spring mvc 模式 -->
<bean id="viewResolver"
     class="org.springframework.web.servlet.view.InternalResourceViewResolver">
     <property name="viewClass"
          value="org.springframework.web.servlet.view.JstlView"/>
      <property name="prefix"
           value="/"/>

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

 <bean id="messageSourse"
   class="org.springframework.context.support.ReloadableResourceBundleMessageSource"
   p:basename="i18n/messages">
  </bean>

</beans></pre>

 本文由用戶 johon 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!