<beans xmlns="http://www.springframework.org/schema/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:task="http://www.springframework.org/schema/task" xmlns:tx="http://www.springframework.org/schema/tx"
	   xmlns:util="http://www.springframework.org/schema/util"
	   xsi:schemaLocation="http://www.springframework.org/schema/mvc
       http://www.springframework.org/schema/mvc/spring-mvc.xsd
       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-3.0.xsd
        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
	<!-- 指定自己定义的validator -->
	<mvc:annotation-driven validator="validator"/>
	<!-- 以下 validator  ConversionService 在使用 mvc:annotation-driven 会 自动注册-->
	<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
		<property name="providerClass" value="org.hibernate.validator.HibernateValidator"/>
		<!-- 如果不加默认到 使用classpath下的 ValidationMessages.properties
		<property name="validationMessageSource" ref="messageSource"/>-->
	</bean>
	<bean class="com.ag.secp.platform.spring.SpringApplicationContext"/>
	<bean class="com.ag.secp.platform.spring.SpringContextHolder"/>
	<!-- Scans the classpath of this application for @Components to deploy as beans-->
	<context:component-scan base-package="com.ag" />
	<!--扫描权限相关-->
	<context:component-scan base-package="com.wb.permission" />


	<import resource="classpath*:/spring-redis.xml" />
<!--	<import resource="classpath*:/nacos.xml" />-->
	<import resource="classpath*:/applicationContext-db.xml" />


	<!-- Configures the @Controller programming model-->
	<mvc:annotation-driven />
	<task:annotation-driven scheduler="qbScheduler" mode="proxy"/>
	<task:scheduler id="qbScheduler" pool-size="10"/>
	<mvc:resources location="/admin/images/" mapping="/admin/images/**"/>
	<mvc:resources location="/admin/images/" mapping="/admin/images/**"/>
	<mvc:resources location="/admin/css/" mapping="/admin/css/**"/>
	<mvc:resources location="/admin/bootcss/" mapping="/admin/bootcss/**"/>
	<mvc:resources location="/admin/js/" mapping="/admin/js/**"/>
	<mvc:resources location="/admin/fonts/" mapping="/admin/fonts/**"/>
	<mvc:resources location="/supcan/" mapping="/supcan/**"/>
	<mvc:resources location="/js/ueditor/" mapping="/js/ueditor/**"/>
	<!--springMVC+thymeleaf的跳转页面配置-->
	<bean id="templateResolver" class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
		<property name="prefix" value="/WEB-INF/views/" />
		<property name="suffix" value=".html" />
		<property name="templateMode" value="XHTML" />
		<!--这里要设置编码 -->
		<property name="characterEncoding" value="UTF-8"/>
		<property name="cacheable" value="false"/>
	</bean>
	<bean id="templateEngine"
		  class="org.thymeleaf.spring4.SpringTemplateEngine">
		<property name="templateResolver" ref="templateResolver" />
	</bean>
	<bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
		<property name="templateEngine" ref="templateEngine" />
		<property name="order" value="1" />
		<!--这里要设置编码 -->
		<property name="characterEncoding" value="UTF-8"/>
	</bean>
	<bean id="jdbcTemplate"
		  class="org.springframework.jdbc.core.JdbcTemplate" abstract="false"
		  lazy-init="false" autowire="default">
		<property name="dataSource">
			<ref bean="dataSource" />
		</property>
	</bean>
	<bean id="sqlSessionTemplate"     class="org.mybatis.spring.SqlSessionTemplate">
		<constructor-arg index="0" ref="sqlSessionFactory" />
	</bean>

	<!-- 事务管理器 -->
	<bean id="txManager"
		  class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>

	<!-- 事务注解驱动，标注@Transactional的类和方法将具有事务性 -->
	<tx:annotation-driven transaction-manager="txManager" proxy-target-class="true"/>

	<!--springmvc 配置-->

	<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
		<property name="messageConverters">
			<list>
				<ref bean="mappingJackson2HttpMessageConverter" />
			</list>
		</property>
	</bean>
	<bean id="mappingJackson2HttpMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
		<property name="supportedMediaTypes">
			<list>
				<value>text/html;charset=UTF-8</value>
				<value>text/json;charset=UTF-8</value>
				<value>application/json;charset=UTF-8</value>
			</list>
		</property>
	</bean>

</beans>