|
@@ -1,195 +0,0 @@
|
|
|
-<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:tx="http://www.springframework.org/schema/tx"
|
|
|
- xmlns:aop="http://www.springframework.org/schema/aop"
|
|
|
- xmlns:websocket="http://www.springframework.org/schema/websocket"
|
|
|
- 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-3.2.xsd
|
|
|
- http://www.springframework.org/schema/tx
|
|
|
- http://www.springframework.org/schema/tx/spring-tx.xsd
|
|
|
- http://www.springframework.org/schema/aop
|
|
|
- http://www.springframework.org/schema/aop/spring-aop.xsd
|
|
|
- http://www.springframework.org/schema/websocket
|
|
|
- http://www.springframework.org/schema/websocket/spring-websocket.xsd" default-lazy-init="true">
|
|
|
-
|
|
|
- <description>opencron server</description>
|
|
|
-
|
|
|
- <bean id="config" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
|
|
|
- <property name="locations">
|
|
|
- <list>
|
|
|
- <value>classpath:*.properties</value>
|
|
|
- </list>
|
|
|
- </property>
|
|
|
- </bean>
|
|
|
-
|
|
|
- <bean id="propertyConfigurer" class="org.opencron.common.utils.PropertyPlaceholder">
|
|
|
- <property name="properties" ref="config"/>
|
|
|
- <property name="ignoreResourceNotFound" value="true"/>
|
|
|
- </bean>
|
|
|
-
|
|
|
- <context:annotation-config/>
|
|
|
-
|
|
|
- <context:component-scan base-package="org.opencron" scoped-proxy="targetClass"/>
|
|
|
-
|
|
|
-
|
|
|
- <!-- dataSource -->
|
|
|
- <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
|
|
|
- <!-- 基本属性 url、user、password -->
|
|
|
- <property name="driverClassName" value="${jdbc.driver}"/>
|
|
|
- <property name="url" value="${jdbc.url}"/>
|
|
|
- <property name="username" value="${jdbc.username}"/>
|
|
|
- <property name="password" value="${jdbc.password}"/>
|
|
|
-
|
|
|
- <!-- 配置初始化大小、最小、最大 -->
|
|
|
- <property name="initialSize" value="3"/>
|
|
|
- <property name="minIdle" value="2"/>
|
|
|
- <property name="maxActive" value="20"/>
|
|
|
-
|
|
|
- <!-- 配置获取连接等待超时的时间 -->
|
|
|
- <property name="maxWait" value="60000"/>
|
|
|
-
|
|
|
- <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
|
|
|
- <property name="timeBetweenEvictionRunsMillis" value="60000"/>
|
|
|
-
|
|
|
- <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
|
|
|
- <property name="minEvictableIdleTimeMillis" value="300000"/>
|
|
|
-
|
|
|
- <property name="validationQuery" value="SELECT 'x'"/>
|
|
|
- <property name="testWhileIdle" value="true"/>
|
|
|
- <property name="testOnBorrow" value="false"/>
|
|
|
- <property name="testOnReturn" value="false"/>
|
|
|
-
|
|
|
- <!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
|
|
|
- <property name="poolPreparedStatements" value="true"/>
|
|
|
- <property name="maxPoolPreparedStatementPerConnectionSize" value="20"/>
|
|
|
-
|
|
|
- <!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 -->
|
|
|
- <property name="filters" value="stat"/>
|
|
|
- </bean>
|
|
|
-
|
|
|
- <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
|
|
|
- <property name="dataSource" ref="dataSource"/>
|
|
|
- <property name="namingStrategy">
|
|
|
- <bean class="org.hibernate.cfg.DefaultNamingStrategy"/>
|
|
|
- </property>
|
|
|
- <property name="hibernateProperties">
|
|
|
- <props>
|
|
|
- <prop key="hibernate.dialect">${hibernate.dialect}</prop>
|
|
|
- <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
|
|
|
- <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
|
|
|
- <prop key="hibernate.current_session_context_class">${hibernate.current_session_context_class}</prop>
|
|
|
- <prop key="hibernate.cache.provider_class">${hibernate.cache.provider_class}</prop>
|
|
|
- <prop key="hibernate.cache.region.factory_class">${hibernate.cache.region.factory_class}</prop>
|
|
|
- <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}</prop>
|
|
|
- <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
|
|
|
- <prop key="jdbc.use_scrollable_resultset">${jdbc.use_scrollable_resultset}</prop>
|
|
|
- <prop key="hibernate.c3p0.preferredTestQuery">select 1;</prop>
|
|
|
- <prop key="hibernate.connectio.useUnicode">true</prop>
|
|
|
- <prop key="hibernate.connection.characterEncoding">utf-8</prop>
|
|
|
- <prop key="hibernate.autoReconnect">true</prop>
|
|
|
- <prop key="hibernate.hbm2ddl.auto">update</prop>
|
|
|
- </props>
|
|
|
- </property>
|
|
|
- <property name="packagesToScan" value="org.opencron.server.domain"/>
|
|
|
- </bean>
|
|
|
-
|
|
|
- <!-- 事务配置 -->
|
|
|
- <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
|
|
|
- <property name="sessionFactory">
|
|
|
- <ref bean="sessionFactory"/>
|
|
|
- </property>
|
|
|
- </bean>
|
|
|
-
|
|
|
- <!-- 使用annotation定义事务 -->
|
|
|
- <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
|
|
|
- <aop:aspectj-autoproxy proxy-target-class="true"/>
|
|
|
-
|
|
|
- <!-- dataSource end -->
|
|
|
-
|
|
|
- <!-- MVC -->
|
|
|
- <!-- 全局异常配置 -->
|
|
|
- <bean id="exceptionHandler" class="org.opencron.server.handler.ExceptionHandler"/>
|
|
|
-
|
|
|
- <!--防止 @ResponseBody 中文乱码 此配置必须放在 注解驱动 前面-->
|
|
|
- <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
|
|
|
- <property name="messageConverters">
|
|
|
- <list>
|
|
|
- <ref bean="stringHttpMessageConverter"/>
|
|
|
- <ref bean="jsonHttpMessageConverter"/>
|
|
|
- </list>
|
|
|
- </property>
|
|
|
- </bean>
|
|
|
-
|
|
|
- <!--字符串试图,解决ResponseBody 乱码-->
|
|
|
- <bean id="stringHttpMessageConverter" class="org.springframework.http.converter.StringHttpMessageConverter">
|
|
|
- <property name="supportedMediaTypes">
|
|
|
- <list>
|
|
|
- <value>text/plain;charset=UTF-8</value>
|
|
|
- </list>
|
|
|
- </property>
|
|
|
- </bean>
|
|
|
- <!--Json 视图-->
|
|
|
- <bean id="jsonHttpMessageConverter"
|
|
|
- class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
|
|
|
-
|
|
|
- <mvc:annotation-driven/>
|
|
|
- <mvc:resources mapping="/static/**" location="/static/"/>
|
|
|
- <mvc:resources mapping="/favicon.ico" location="/favicon.ico"/>
|
|
|
- <mvc:default-servlet-handler/>
|
|
|
-
|
|
|
- <mvc:interceptors>
|
|
|
- <mvc:interceptor>
|
|
|
- <mvc:mapping path="/**"/>
|
|
|
- <bean class="org.opencron.server.handler.SecurityHandlerInterceptor"/>
|
|
|
- </mvc:interceptor>
|
|
|
- </mvc:interceptors>
|
|
|
-
|
|
|
- <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
|
|
- <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
|
|
|
- <property name="prefix" value="/WEB-INF/view/"/>
|
|
|
- <property name="suffix" value=".jsp"/>
|
|
|
- </bean>
|
|
|
-
|
|
|
- <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
|
|
- <!-- set the max upload size 100M -->
|
|
|
- <property name="maxUploadSize">
|
|
|
- <value>104857600</value>
|
|
|
- </property>
|
|
|
- <property name="maxInMemorySize">
|
|
|
- <value>4096</value>
|
|
|
- </property>
|
|
|
- <property name="resolveLazily" value="true"/>
|
|
|
- </bean>
|
|
|
-
|
|
|
- <!-- MVC end -->
|
|
|
-
|
|
|
- <!-- websocket -->
|
|
|
- <bean id="terminalHandler" class="org.opencron.server.websocket.TerminalHandler"/>
|
|
|
- <bean id="webSocketHandShaker" class="org.opencron.server.websocket.TerminalHandShaker"/>
|
|
|
-
|
|
|
- <websocket:handlers>
|
|
|
- <websocket:mapping path="/terminal.ws" handler="terminalHandler"/>
|
|
|
- <websocket:handshake-interceptors>
|
|
|
- <ref bean="webSocketHandShaker"/>
|
|
|
- </websocket:handshake-interceptors>
|
|
|
- </websocket:handlers>
|
|
|
-
|
|
|
- <websocket:handlers>
|
|
|
- <websocket:mapping path="/terminal.js" handler="terminalHandler"/>
|
|
|
- <websocket:handshake-interceptors>
|
|
|
- <ref bean="webSocketHandShaker"/>
|
|
|
- </websocket:handshake-interceptors>
|
|
|
- <websocket:sockjs/>
|
|
|
- </websocket:handlers>
|
|
|
- <!-- websocket end -->
|
|
|
-
|
|
|
- <!--task-->
|
|
|
- <bean class="org.opencron.server.job.OpencronTask" lazy-init="false"/>
|
|
|
-
|
|
|
-</beans>
|