Skip to content

Commit

Permalink
Split out various webmvc spring configuration elements
Browse files Browse the repository at this point in the history
  • Loading branch information
martinlau committed Jul 2, 2013
1 parent ba987a1 commit 47a33b5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 27 deletions.
17 changes: 17 additions & 0 deletions src/main/webapp/WEB-INF/spring/fixture-messages.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.CookieLocaleResolver"
p:defaultLocale="en"
p:cookieName="locale"/>

<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource"
p:basename="META-INF.spring.messages.fixture"
p:defaultEncoding="UTF-8"/>

</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,16 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p"
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
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">

<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="META-INF.spring.messages.fixture"/>
<property name="defaultEncoding" value="UTF-8"/>
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.tiles3.TilesViewResolver"/>

<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="defaultLocale" value="en"/>
<property name="cookieName" value="locale"/>
</bean>

<bean id="themeSource" class="org.springframework.ui.context.support.ResourceBundleThemeSource">
<property name="basenamePrefix" value="META-INF.spring.theme."/>
</bean>

<bean id="themeResolver" class="org.springframework.web.servlet.theme.CookieThemeResolver">
<property name="defaultThemeName" value="united"/>
<property name="cookieName" value="theme"/>
</bean>

<bean id="viewResolver" class="org.springframework.web.servlet.view.tiles3.TilesViewResolver"/>

<bean class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="checkRefresh" value="true"/>
</bean>
<bean class="org.springframework.web.servlet.view.tiles3.TilesConfigurer"
p:checkRefresh="true"/>

<context:component-scan base-package="io.fixture.controller"/>

Expand All @@ -47,7 +28,7 @@
cache-period="#{T(java.lang.Integer).MAX_VALUE}"/>

<mvc:resources mapping="/resources/**"
location="/resources/"
cache-period="#{60 * 60 * 24}"/>
location="resources"
cache-period="#{T(java.lang.Integer).MAX_VALUE}"/>

</beans>
16 changes: 16 additions & 0 deletions src/main/webapp/WEB-INF/spring/fixture-theme.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="themeSource"
class="org.springframework.ui.context.support.ResourceBundleThemeSource"
p:basenamePrefix="META-INF.spring.theme."/>

<bean id="themeResolver"
class="org.springframework.web.servlet.theme.CookieThemeResolver"
p:defaultThemeName="united"
p:cookieName="theme"/>

</beans>
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/fixture-web.xml</param-value>
<param-value>/WEB-INF/spring/*.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Expand Down

0 comments on commit 47a33b5

Please sign in to comment.