1:修改mysql驱动包为5.1.35
2:更换mysql的连接池为druid 3:添加druid对spring的监控及添加webui的账号密码 4:添加astana的jdbc和app*-redis.xml的配置
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
<?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:lang="http://www.springframework.org/schema/lang" xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:cache="http://www.springframework.org/schema/cache" xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:cache="http://www.springframework.org/schema/cache"
|
||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xmlns:task="http://www.springframework.org/schema/task"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
@@ -39,17 +43,18 @@
|
||||
cache-period="31536000" />
|
||||
|
||||
<!-- 定义无Controller的path<->view直接映射 -->
|
||||
<mvc:view-controller path="/" view-name="redirect:/nis/index" />
|
||||
<mvc:view-controller path="/"
|
||||
view-name="redirect:/nis/index" />
|
||||
|
||||
<!-- 启用spring mvc注解 -->
|
||||
<context:annotation-config />
|
||||
|
||||
<!-- 默认注解映射支持 -->
|
||||
<mvc:annotation-driven />
|
||||
<!-- 配置任务线性池 -->
|
||||
<!-- 配置任务线性池 -->
|
||||
<task:executor id="executor" pool-size="5"></task:executor>
|
||||
<task:scheduler id="scheduler" pool-size="5"></task:scheduler>
|
||||
<!-- 开启定时任务注解 -->
|
||||
<!-- 开启定时任务注解 -->
|
||||
<task:annotation-driven scheduler="scheduler"
|
||||
executor="executor" />
|
||||
|
||||
@@ -59,7 +64,8 @@
|
||||
<!-- redis 工具类 -->
|
||||
<bean id="redisDao" class="com.nis.util.redis.RedisDao" />
|
||||
<!-- elasticsearch 工具类 将查询转化为elasticsearch-sql支持的语法 -->
|
||||
<bean id="elasticsearchSqlDao" class="com.nis.util.elasticsearch.ElasticsearchSqlDao" />
|
||||
<bean id="elasticsearchSqlDao"
|
||||
class="com.nis.util.elasticsearch.ElasticsearchSqlDao" />
|
||||
<!-- 定义httpclient连接池 -->
|
||||
<bean id="httpClientConnectionManager"
|
||||
class="org.apache.http.impl.conn.PoolingHttpClientConnectionManager"
|
||||
@@ -67,13 +73,16 @@
|
||||
<!-- 设置连接总数 -->
|
||||
<property name="maxTotal" value="${http.pool.maxTotal}"></property>
|
||||
<!-- 设置每个地址的并发数 -->
|
||||
<property name="defaultMaxPerRoute" value="${http.pool.defaultMaxPerRoute}"></property>
|
||||
<property name="defaultMaxPerRoute"
|
||||
value="${http.pool.defaultMaxPerRoute}"></property>
|
||||
</bean>
|
||||
|
||||
<!-- 定义 HttpClient工厂,这里使用HttpClientBuilder构建 -->
|
||||
<bean id="httpClientBuilder" class="org.apache.http.impl.client.HttpClientBuilder"
|
||||
<bean id="httpClientBuilder"
|
||||
class="org.apache.http.impl.client.HttpClientBuilder"
|
||||
factory-method="create">
|
||||
<property name="connectionManager" ref="httpClientConnectionManager"></property>
|
||||
<property name="connectionManager"
|
||||
ref="httpClientConnectionManager"></property>
|
||||
</bean>
|
||||
|
||||
<!-- 得到httpClient的实例 -->
|
||||
@@ -83,41 +92,53 @@
|
||||
<!-- 定期清理无效的连接 -->
|
||||
<bean class="com.nis.util.httpclient.IdleConnectionEvictor"
|
||||
destroy-method="shutdown">
|
||||
<constructor-arg index="0" ref="httpClientConnectionManager" />
|
||||
<constructor-arg index="0"
|
||||
ref="httpClientConnectionManager" />
|
||||
<!-- 间隔一分钟清理一次 -->
|
||||
<constructor-arg index="1" value="60000" />
|
||||
</bean>
|
||||
|
||||
<!-- 定义requestConfig的工厂 -->
|
||||
<bean id="requestConfigBuilder" class="org.apache.http.client.config.RequestConfig.Builder">
|
||||
<bean id="requestConfigBuilder"
|
||||
class="org.apache.http.client.config.RequestConfig.Builder">
|
||||
<!-- 从连接池中获取到连接的最长时间 -->
|
||||
<property name="connectionRequestTimeout" value="${http.request.connectionRequestTimeout}" />
|
||||
<property name="connectionRequestTimeout"
|
||||
value="${http.request.connectionRequestTimeout}" />
|
||||
<!-- 创建连接的最长时间 -->
|
||||
<property name="connectTimeout" value="${http.request.connectTimeout}" />
|
||||
<property name="connectTimeout"
|
||||
value="${http.request.connectTimeout}" />
|
||||
<!-- 数据传输的最长时间 -->
|
||||
<property name="socketTimeout" value="${http.request.socketTimeout}" />
|
||||
<property name="socketTimeout"
|
||||
value="${http.request.socketTimeout}" />
|
||||
<!-- 提交请求前测试连接是否可用 -->
|
||||
<property name="staleConnectionCheckEnabled" value="${http.request.staleConnectionCheckEnabled}" />
|
||||
<property name="staleConnectionCheckEnabled"
|
||||
value="${http.request.staleConnectionCheckEnabled}" />
|
||||
</bean>
|
||||
|
||||
<!-- 得到requestConfig实例 -->
|
||||
<bean id="requestConfig" factory-bean="requestConfigBuilder"
|
||||
factory-method="build" />
|
||||
<!--事务控制驱动注解,发现注解@Transactional 时,找transactionManager事务管理器 -->
|
||||
<tx:annotation-driven transaction-manager="transactionManager" />
|
||||
<tx:annotation-driven
|
||||
transaction-manager="transactionManager" />
|
||||
|
||||
|
||||
<!-- autodetection of such annotated controllers -->
|
||||
<context:component-scan base-package="com.nis.web"></context:component-scan>
|
||||
<context:component-scan base-package="com.nis.restful"></context:component-scan>
|
||||
<context:component-scan base-package="com.nis.test"></context:component-scan>
|
||||
<context:component-scan
|
||||
base-package="com.nis.web"></context:component-scan>
|
||||
<context:component-scan
|
||||
base-package="com.nis.restful"></context:component-scan>
|
||||
<context:component-scan
|
||||
base-package="com.nis.test"></context:component-scan>
|
||||
|
||||
<!-- 默认的注解映射的支持,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping -->
|
||||
<mvc:annotation-driven
|
||||
content-negotiation-manager="contentNegotiationManager">
|
||||
<mvc:message-converters register-defaults="true">
|
||||
<mvc:message-converters
|
||||
register-defaults="true">
|
||||
<!-- 将StringHttpMessageConverter的默认编码设为UTF-8 -->
|
||||
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
|
||||
<bean
|
||||
class="org.springframework.http.converter.StringHttpMessageConverter">
|
||||
<constructor-arg value="UTF-8" />
|
||||
</bean>
|
||||
<!-- 将Jackson2HttpMessageConverter的默认格式化输出为false -->
|
||||
@@ -137,7 +158,8 @@
|
||||
<bean
|
||||
class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
|
||||
<constructor-arg>
|
||||
<bean class="org.springframework.oxm.xstream.XStreamMarshaller">
|
||||
<bean
|
||||
class="org.springframework.oxm.xstream.XStreamMarshaller">
|
||||
<property name="streamDriver">
|
||||
<bean class="com.thoughtworks.xstream.io.xml.StaxDriver" />
|
||||
</property>
|
||||
@@ -151,7 +173,8 @@
|
||||
</property>
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<property name="supportedMediaTypes" value="application/xml"></property>
|
||||
<property name="supportedMediaTypes"
|
||||
value="application/xml"></property>
|
||||
</bean>
|
||||
</mvc:message-converters>
|
||||
</mvc:annotation-driven>
|
||||
@@ -177,9 +200,12 @@
|
||||
<mvc:exclude-mapping path="/nis/login" />
|
||||
<mvc:exclude-mapping path="/nis/sys/index" />
|
||||
<mvc:exclude-mapping path="/nis/sys/menu/tree" />
|
||||
<mvc:exclude-mapping path="/nis/sys/menu/treeData" />
|
||||
<mvc:exclude-mapping path="/nis/sys/user/getToDoTaskNum" />
|
||||
<mvc:exclude-mapping path="/nis/sys/user/toDoTask" />
|
||||
<mvc:exclude-mapping
|
||||
path="/nis/sys/menu/treeData" />
|
||||
<mvc:exclude-mapping
|
||||
path="/nis/sys/user/getToDoTaskNum" />
|
||||
<mvc:exclude-mapping
|
||||
path="/nis/sys/user/toDoTask" />
|
||||
<bean class="com.nis.interceptor.LogInterceptor" />
|
||||
</mvc:interceptor>
|
||||
<!-- 添加restful服务的过滤 -->
|
||||
@@ -238,14 +264,17 @@
|
||||
<property name="order" value="0" />
|
||||
</bean>
|
||||
|
||||
<bean id="RestServiceExceptionHandler" class="com.nis.restful.AppExceptionHandler">
|
||||
<bean id="RestServiceExceptionHandler"
|
||||
class="com.nis.restful.AppExceptionHandler">
|
||||
<property name="order" value="1" />
|
||||
<property name="errorResolver">
|
||||
<bean class="com.nis.restful.DefaultRestErrorResolver">
|
||||
<property name="exceptionMappingDefinitions">
|
||||
<map>
|
||||
<entry key="com.nis.restful.RestServiceException" value="400" />
|
||||
<entry key="com.nis.restful.ServiceRuntimeException" value="500" />
|
||||
<entry key="com.nis.restful.RestServiceException"
|
||||
value="400" />
|
||||
<entry key="com.nis.restful.ServiceRuntimeException"
|
||||
value="500" />
|
||||
<entry key="Throwable" value="500" />
|
||||
</map>
|
||||
</property>
|
||||
@@ -276,8 +305,23 @@
|
||||
<property name="uploadTempDir" value="/upload"></property>
|
||||
</bean>
|
||||
|
||||
|
||||
|
||||
<!-- 设置druid对spring的监控 -->
|
||||
<bean id="druid-stat-interceptor"
|
||||
class="com.alibaba.druid.support.spring.stat.DruidStatInterceptor" />
|
||||
<bean id="druid-stat-pointcut"
|
||||
class="org.springframework.aop.support.JdkRegexpMethodPointcut"
|
||||
scope="prototype">
|
||||
<property name="patterns">
|
||||
<list>
|
||||
<value>com.nis.web.service.*</value>
|
||||
<value>com.nis.web.dao.*</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
<aop:config proxy-target-class="true">
|
||||
<aop:advisor advice-ref="druid-stat-interceptor"
|
||||
pointcut-ref="druid-stat-pointcut" />
|
||||
</aop:config>
|
||||
|
||||
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user