applicationContext.xml 2.2 KB

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