zeus-context.xml 4.29 KB
<?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:p="http://www.springframework.org/schema/p"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:zeus="http://repo.taobao.com/schema"
	xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
			http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
			http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
			http://repo.taobao.com/schema http://repo.taobao.com/schema/zeus-component.xsd
			http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
			http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">

	<!-- 组件扫描配置 -->
	<zeus:component-scan base-package="com.taobao.sample.petstore.web.home" namespace="home" default-filter-types="package" />
	<zeus:component-scan base-package="com.taobao.sample.petstore.web.user" namespace="user" default-filter-types="package" />
	<zeus:component-scan base-package="com.taobao.sample.petstore.web.store" namespace="store" default-filter-types="package" />	
	<zeus:component-scan base-package="com.taobao.sample.petstore.web.admin" namespace="admin" default-filter-types="package" />	
	<zeus:component-scan base-package="com.taobao.sample.petstore.rpc" namespace="rpc" default-filter-types="package" />
	
	<!-- formResolver配置 -->
	<bean name="formResolver" class="com.taobao.zeus.core.form.FormResolverImpl">
	    <property name="locations">
			<list>
			     <value>classpath:forms.xml</value>		
			</list>
		</property>		
		<property name="enabledClientValidation" value="true"></property>
		<property name="enabledServerValidation" value="true"></property>
	</bean>
	
	<bean id="multipartResolver"
		class="com.taobao.zeus.web.multipart.CommonsMultipartEngancedResolver">
		<!-- one of the properties available; the maximum file size in bytes -->
		<property name="maxUploadSize" value="10240000" />
		<property name="resolveLazily" value="true"></property>
	</bean>
	
	<!-- velocity渲染引擎配置 -->
	<bean name="velocityConfig">
		<property name="velocityProperties">
			<props>
				<prop key="input.encoding">UTF-8</prop>
				<prop key="output.encoding">UTF-8</prop>

				<prop key="eventhandler.referenceinsertion.class">
					com.taobao.zeus.security.velocity.DefaultSecurityReferenceInsertionEventHandler
				</prop>

			</props>
		</property>
		<property name="vmlibaries">
			<list>
				<value>headquarters/security/securitymacro.vm</value>
				<value>macros.vm</value>
			</list>
		</property>
	</bean>
	
	<!-- 自定义在页面使用的工具 -->
	<bean name="stringUtil" class="com.taobao.common.lang.StringUtil" />
	<bean name="bundle" class="com.taobao.common.resourcebundle.util.ResourceBundleTool" />
	<bean name="messageUtil" class="com.taobao.common.lang.MessageUtil" />
	<bean id="viewToolFactory" class="com.taobao.zeus.web.view.tools.impl.DefaultViewToolFactory">
		<property name="tools">
			<map>
				<entry key="stringUtil" value="stringUtil" />
				<entry key="bundle" value="bundle" />
				<entry key="messageUtil" value="messageUtil" />				
			</map>
		</property>
	</bean>
		
	<!-- 国际化相关配置 -->
	<bean id="localeResolver"
		class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
		<property name="defaultLocale" value="zh_CN" />
	</bean>
	
	<!-- cookie_based_session配置 -->
	<bean name="wrapperFilter" class="com.taobao.zeus.web.filter.WrapperFilter">
		<property name="sessionMaxSurvivalTime" value="${sessionMaxSurvivalTime}"></property>
		<property name="storeProviders">
			<list>
				<bean
					class="com.taobao.zeus.web.filter.privoder.ContainerSessionProvider">
					<property name="sessionName" value="session_key"></property>
					<property name="regex" value="userName"></property>
				</bean>
				<bean
					class="com.taobao.zeus.web.filter.privoder.CookieSessionStoreProvider">
					<property name="cookieName" value="cookie_based_session_zeus"></property>
					<property name="compressed" value="true"></property>
					<property name="regex" value=".*"></property>
				</bean>
			</list>
		</property>
	</bean>
</beans>