applicationContext.xml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans default-lazy-init="false"
  3. xmlns="http://www.springframework.org/schema/beans"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xmlns:context="http://www.springframework.org/schema/context"
  6. xmlns:tx="http://www.springframework.org/schema/tx"
  7. xmlns:util="http://www.springframework.org/schema/util"
  8. xmlns:mvc="http://www.springframework.org/schema/mvc"
  9. xsi:schemaLocation="http://www.springframework.org/schema/beans
  10. http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
  11. http://www.springframework.org/schema/tx
  12. http://www.springframework.org/schema/tx/spring-tx.xsd
  13. http://www.springframework.org/schema/context
  14. http://www.springframework.org/schema/context/spring-context.xsd
  15. http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
  16. http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"
  17. >
  18. <!--业务Beans, 使用注解方式配置-->
  19. <context:component-scan base-package="com.yihu">
  20. <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
  21. </context:component-scan>
  22. <!--====================返回为null的时候转“”==========================-->
  23. <mvc:annotation-driven>
  24. <mvc:message-converters register-defaults="true">
  25. <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
  26. <property name="objectMapper">
  27. <bean class="com.fasterxml.jackson.databind.ObjectMapper">
  28. <property name="serializationInclusion">
  29. <value type="com.fasterxml.jackson.annotation.JsonInclude.Include">NON_NULL</value>
  30. </property>
  31. </bean>
  32. </property>
  33. </bean>
  34. </mvc:message-converters>
  35. </mvc:annotation-driven>
  36. <bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
  37. <property name="cookieMaxAge" value="604800"/>
  38. <property name="defaultLocale" value="zh_CN"/>
  39. <property name="cookieName" value="Language"></property>
  40. </bean>
  41. <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"/>
  42. </beans>