spring-web-context.xml 3.76 KB
<?xml  version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xmlns:context="http://www.springframework.org/schema/context"
	   xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns="http://www.springframework.org/schema/beans"
	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/aop
                        http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
                        http://www.springframework.org/schema/mvc
                        http://www.springframework.org/schema/mvc/spring-mvc.xsd">

	<context:property-placeholder location="classpath:*.properties" />
	<context:component-scan base-package="com.ui" />
    <!-- 打开aop 注解 -->
    <aop:aspectj-autoproxy/>
	<bean id="appAspect" class="com.ui.ctrl.app.AppAspect" />


	<mvc:annotation-driven>
		<mvc:message-converters>
			<ref bean="stringConverter" />
			<ref bean="jsonConverter" />
		</mvc:message-converters>
	</mvc:annotation-driven>
	
	<!--字符串转换器 -->
	<bean id="stringConverter" class="org.springframework.http.converter.StringHttpMessageConverter">
		<property name="supportedMediaTypes">
			<list>
				<value>text/plain;charset=UTF-8</value>
				<value>text/html;charset=UTF-8</value>
				<value>application/octet-stream</value>
			</list>
		</property>
	</bean>
	
	<!-- json转换器 application/json -->
	<bean id="jsonConverter" class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
		<property name="supportedMediaTypes">
			<list>
				<!--<value>application/json</value>-->
				<value>*/*</value>
			</list>
		</property>
	</bean>

	<bean
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix">
			<value>/jsp/</value>
		</property>
		<property name="suffix">
			<value>.jsp</value>
		</property>
	</bean>

	<!-- 静态资源访问  -->
	<mvc:resources location="/js/" mapping="/js/**"/>
	<mvc:resources location="/css/" mapping="/css/**"/>
	<mvc:resources location="/img/" mapping="/img/**"/>
	<mvc:resources location="/jsp/" mapping="/jsp/**"/>
	<mvc:resources location="/fonts/" mapping="/fonts/**"/>
	<mvc:resources location="/script/" mapping="/script/**"/>
	<mvc:resources location="/sql_format/" mapping="/sql_format/**"/>

	<mvc:interceptors>
		<!-- 登录验证 -->
		<mvc:interceptor>
			<mvc:mapping path="/**"/>
			<mvc:exclude-mapping path="/bigdata/**"/>
			<mvc:exclude-mapping path="/hystrix/**"/>
			<mvc:exclude-mapping path="/user/**"/>
			<mvc:exclude-mapping path="/img/**"/>
			<mvc:exclude-mapping path="/css/**"/>
			<mvc:exclude-mapping path="/js/**"/>
			<mvc:exclude-mapping path="/fonts/**"/>
			<mvc:exclude-mapping path="/script/**"/>
			<mvc:exclude-mapping path="/sql_format/**"/>
			<mvc:exclude-mapping path="/dashboard/**"/>
			<mvc:exclude-mapping path="/app_**/**"/>
			<mvc:exclude-mapping path="/deliverMessageVoice/**"/>
			<mvc:exclude-mapping path="/deliverMessagetxt/**"/>
			<mvc:exclude-mapping path="/systemTest/**"/>
			<mvc:exclude-mapping path="/recvMonitAlarm"/>
			<mvc:exclude-mapping path="/awsapi/sns" />
			<mvc:exclude-mapping path="/testcommon/testUpLoadData" />
			<mvc:exclude-mapping path="/workSystem/callbackTest" />
			<mvc:exclude-mapping path="/cmdb/api" />
			<mvc:exclude-mapping path="/outer/*" />
			<mvc:exclude-mapping path="/dashboard/toDashboard" />
			<bean class="com.ui.interceptor.AuthInterceptor"/>
		</mvc:interceptor>

	</mvc:interceptors>

</beans>