所有配置文件在此
spring servlet:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" 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" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.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.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <aop:aspectj-autoproxy proxy-target-class="true"/> <aop:config proxy-target-class="true"/> <!-- 会自动注册DefaultAnnotationHandlerMapping与AnnotationMethodHandlerAdapter 两个bean,是spring MVC为@Controllers分发请求所必须的 --> <mvc:annotation-driven content-negotiation-manager="contentNegotiationManager"> <mvc:message-converters register-defaults="true"> <!-- 将StringHttpMessageConverter的默认编码设为UTF-8 --> <bean class="org.springframework.http.converter.StringHttpMessageConverter"> <constructor-arg name="defaultCharset" value="UTF-8"/> </bean> <!-- 将Jackson2HttpMessageConverter的默认格式化输出设为true --> <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"> <property name="prettyPrint" value="true"/> <property name="supportedMediaTypes"> <list> <value>text/html;charset=UTF-8</value> </list> </property> </bean> </mvc:message-converters> </mvc:annotation-driven> <!-- REST中根据URL后缀自动判定Content-Type及相应的View --> <bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean"> <property name="ignoreAcceptHeader" value="true"/> <property name="defaultContentType" value="text/html"/> <property name="mediaTypes"> <value> json=application/json xml=application/xml </value> </property> </bean> <!-- 支持返回json --> <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"> <property name="messageConverters"> <list> <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/> <bean class="org.springframework.http.converter.StringHttpMessageConverter"> <property name="supportedMediaTypes"> <list> <value>text/html; charset=utf-8</value> </list> </property> </bean> <bean class="org.springframework.http.converter.ResourceHttpMessageConverter"/> <bean class="org.springframework.http.converter.xml.SourceHttpMessageConverter"/> <bean class="org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter"/> </list> </property> </bean> <!-- 扫描service(自动将servicec层注入) --> <context:component-scan base-package="com.focustech.micen"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service"/> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Repository"/> </context:component-scan> <!-- 以下 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 id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource" p:basename="i18n/messages/"/> <!-- Maps '/' requests to the 'home' view --> <mvc:view-controller path="/" view-name="/login"/> <!-- resources,js,css可多选 --> <mvc:resources location="/assets/" mapping="/assets/**"/> <!-- 配置springMVC处理上传文件的信息 --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" p:defaultEncoding="utf-8" p:maxUploadSize="10485760000" p:maxInMemorySize="40960"/> <bean id="fmXmlEscape" class="freemarker.template.utility.XmlEscape"/> <!-- FreeMarker视图解析 --> <bean id="freeMarkerViewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver" p:prefix="/" p:suffix=".ftl" p:order="1" p:cache="true"> <property name="viewClass" value="org.springframework.web.servlet.view.freemarker.FreeMarkerView"/> <property name="contentType" value="text/html;charset=utf-8"/> <property name="requestContextAttribute" value="request"/> <property name="exposeRequestAttributes" value="true"/> <property name="exposeSessionAttributes" value="true"/> <property name="exposeSpringMacroHelpers" value="true"/> <!-- <property name="viewNames"> <array> <value>*.ftl</value> </array> </property> --> </bean> <!--<bean id="freemarkConfig" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="location" value="classpath:properties/freemark.properties"/> </bean>--> <!-- FreeMarker环境配置 --> <!-- <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"> --> <bean id="freemarkerConfig" class="com.focustech.micen.common.support.ShiroTagFreeMarkerConfigurer"> <!-- freemarker模板位置 --> <property name="templateLoaderPath" value="/views/"/> <property name="defaultEncoding" value="utf-8"/> <property name="freemarkerVariables"> <map> <entry key="xml_escape" value-ref="fmXmlEscape"/> </map> </property> <property name="freemarkerSettings"> <props> <prop key="template_update_delay">5</prop> <!--刷新模板的周期,单位为秒,开发环境中可以设置短一点,正式环境可以长一点 --> <prop key="defaultEncoding">UTF-8</prop> <prop key="url_escaping_charset">UTF-8</prop> <prop key="locale">zh_CN</prop> <prop key="boolean_format">true,false</prop> <prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop> <prop key="date_format">yyyy-MM-dd</prop> <prop key="time_format">HH:mm:ss</prop> <prop key="number_format">#.##</prop> <prop key="whitespace_stripping">true</prop> <prop key="tag_syntax">auto_detect</prop> <prop key="url_escaping_charset">UTF-8</prop> <prop key="template_exception_handler">ignore</prop> <prop key="classic_compatible">true</prop> <!-- auto_import可导入多个文件, 用逗号分开 --> <!--<prop key="auto_import">views/common/*.ftl</prop>--> </props> </property> </bean> <!-- jsp视图解析器 --> <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:order="2" p:prefix="/" p:suffix=".jsp" p:viewClass="org.springframework.web.servlet.view.JstlView"/> <!-- 全局异常配置 start --> <bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="exceptionMappings"> <props> <prop key="java.lang.Exception">error-500</prop> <prop key="java.lang.Throwable">error-404</prop> <prop key="java.sql.SQLException">error-403</prop> <prop key="org.springframework.web.servlet.PageNotFound">error-404</prop> <prop key="org.apache.shiro.ShiroException">error-auth</prop> <prop key="com.focustech.micen.common.exception.AccessException">error-data</prop> </props> </property> <property name="statusCodes"> <props> <prop key="error-404">404</prop> <prop key="error-403">403</prop> <prop key="error-500">500</prop> <prop key="error-auth">505</prop> <prop key="error-data">506</prop> </props> </property> <!-- 设置日志输出级别,不定义则默认不输出警告等错误日志信息 --> <property name="warnLogCategory" value="WARN"></property> <!-- 默认错误页面,当找不到上面mappings中指定的异常对应视图时,使用本默认配置 --> <property name="defaultErrorView" value="error-405"></property> <!-- 默认HTTP状态码 --> <property name="defaultStatusCode" value="500"></property> </bean> </beans>
spring context:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" 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.xsd" default-lazy-init="true"> <!-- 启用shrio授权注解拦截方式 --> <aop:config proxy-target-class="true"></aop:config> <!-- 扫描service(自动将servicec层注入) --> <context:component-scan base-package="com.focustech.micen"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/> <context:include-filter type="annotation" expression="org.springframework.stereotype.Repository"/> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan> <import resource="spring-datasource.xml"/> <import resource="spring-captcha.xml"/> <import resource="spring-shiro.xml"/> </beans>
spring capche:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd" default-lazy-init="true"> <bean id="captchaService" class="com.octo.captcha.service.multitype.GenericManageableCaptchaService"> <constructor-arg index="0" ref="imageEngine"/> <constructor-arg type="int" index="1" value="180"/> <constructor-arg type="int" index="2" value="100000"/> </bean> <bean id="imageEngine" class="com.octo.captcha.engine.GenericCaptchaEngine"> <constructor-arg index="0"> <list> <ref bean="captchaFactory"/> </list> </constructor-arg> </bean> <bean id="captchaFactory" class="com.octo.captcha.image.gimpy.GimpyFactory"> <constructor-arg ref="wordgen"/> <constructor-arg ref="wordtoimage"/> </bean> <!--可选字符--> <bean id="wordgen" class="com.octo.captcha.component.word.wordgenerator.RandomWordGenerator"> <constructor-arg value="0123456789abcdefghijklmnopqrstuvwxyz"/> </bean> <bean id="wordtoimage" class="com.octo.captcha.component.image.wordtoimage.ComposedWordToImage"> <constructor-arg index="0" ref="fontGenRandom"/> <constructor-arg index="1" ref="backGenUni"/> <constructor-arg index="2" ref="decoratedPaster"/> </bean> <bean id="fontGenRandom" class="com.octo.captcha.component.image.fontgenerator.RandomFontGenerator"> <!--最小字体--> <constructor-arg index="0" value="20"/> <!--最大字体--> <constructor-arg index="1" value="20"/> <!--字体--> <constructor-arg index="2"> <list> <bean class="java.awt.Font"> <constructor-arg index="0" value="Arial"/> <constructor-arg index="1" value="0"/> <constructor-arg index="2" value="20"/> </bean> </list> </constructor-arg> </bean> <bean id="backGenUni" class="com.octo.captcha.component.image.backgroundgenerator.UniColorBackgroundGenerator"> <!--背景宽度--> <constructor-arg index="0" value="82"/> <!--背景高度--> <constructor-arg index="1" value="32"/> </bean> <bean id="decoratedPaster" class="com.octo.captcha.component.image.textpaster.DecoratedRandomTextPaster"> <!--最大字符长度--> <constructor-arg type="java.lang.Integer" index="0" value="5"/> <!--最小字符长度--> <constructor-arg type="java.lang.Integer" index="1" value="5"/> <!--文本颜色--> <constructor-arg index="2" ref="colorGen"/> <!--文本混淆--> <constructor-arg index="3"> <list> <ref bean="baffleDecorator"/> </list> </constructor-arg> </bean> <bean id="baffleDecorator" class="com.octo.captcha.component.image.textpaster.textdecorator.BaffleTextDecorator"> <constructor-arg type="java.lang.Integer" index="0" value="0"/> <constructor-arg type="java.awt.Color" index="1" ref="colorWrite"/> </bean> <bean id="colorGen" class="com.octo.captcha.component.image.color.SingleColorGenerator"> <constructor-arg type="java.awt.Color" index="0" ref="colorDimGrey"/> </bean> <bean id="colorWrite" class="java.awt.Color"> <constructor-arg type="int" index="0" value="255"/> <constructor-arg type="int" index="1" value="255"/> <constructor-arg type="int" index="2" value="255"/> </bean> <bean id="colorDimGrey" class="java.awt.Color"> <constructor-arg type="int" index="0" value="0"/> <constructor-arg type="int" index="1" value="102"/> <constructor-arg type="int" index="2" value="204"/> </bean> </beans>
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:cache="http://www.springframework.org/schema/cache" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd" default-lazy-init="true"> <!-- 引入配置文件 --> <!--<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">--> <!--<property name="locations">--> <!--<list>--> <!--<value>classpath*:properties/prodjdbc.properties</value>--> <!--</list>--> <!--</property>--> <!--</bean>--> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" p:dataSource-ref="druidDataSource"/> <!-- mybatis文件配置,扫描所有mapper文件 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean" p:dataSource-ref="druidDataSource" p:configLocation="classpath:mybatis/mybatis-config.xml" p:mapperLocations="classpath:mybatis/mapper/*.xml"/> <!-- sqlSessionTemplate --> <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate"> <constructor-arg index="0" ref="sqlSessionFactory"/> <constructor-arg index="1" value="BATCH"/> </bean> <!-- spring与mybatis整合配置,扫描所有dao --> <!--<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer" p:basePackage="com.focustech.micen.web.dao" p:sqlSessionFactoryBeanName="sqlSessionFactory"/>--> <!-- 对dataSource 数据源进行事务管理 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" p:dataSource-ref="druidDataSource"/> <!-- 事务管理 通知 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <!-- 对insert, update, delete 开头的方法进行事务管理,只要有异常就回滚 --> <tx:method name="insert*" propagation="REQUIRED" rollback-for="java.lang.Throwable"/> <tx:method name="update*" propagation="REQUIRED" rollback-for="java.lang.Throwable"/> <tx:method name="delete*" propagation="REQUIRED" rollback-for="java.lang.Throwable"/> <!-- 对其他方法 使用默认的事务管理, 开启只读, 提高数据库访问性能 --> <tx:method name="*" read-only="true"/> </tx:attributes> </tx:advice> <!-- 事务 aop 配置 --> <aop:config> <aop:pointcut id="serviceMethods" expression="execution(* com.focustech.micen.relational.service..*(..))"/> <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethods"/> </aop:config> <aop:config> <aop:advisor advice-ref="druid-stat-interceptor" pointcut-ref="druid-stat-pointcut"/> </aop:config> <!-- 配置druid监控spring jdbc --> <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.focustech.ossbi.service.*</value> </list> </property> </bean> <!-- 配置使Spring采用CGLIB代理 --> <aop:aspectj-autoproxy proxy-target-class="true"/> <!-- 启用对事务注解的支持 --> <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/> <!-- Cache配置 --> <cache:annotation-driven cache-manager="cacheManager"/> <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" p:cacheManager-ref="ehCacheManagerFactory"/> <bean id="ehCacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:configLocation="classpath:cache/ehcache.xml"/> <!-- local development环境 --> <beans profile="development"> <context:property-placeholder ignore-resource-not-found="true" location="classpath*:properties/devjdbc.properties"/> <!-- dataSource 配置 --> <bean id="druidDataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close"> <!-- 基本属性 url、user、password --> <property name="driverClassName" value="${oracle.driverClassName}"/> <property name="url" value="${oracle.url}"/> <property name="username" value="${oracle.username}"/> <property name="password" value="${oracle.password}"/> <!-- 配置初始化大小、最小、最大 --> <property name="initialSize" value="${ds.initialSize}"/> <property name="minIdle" value="${ds.minIdle}"/> <property name="maxActive" value="${ds.maxActive}"/> <!-- 配置获取连接等待超时的时间 --> <property name="maxWait" value="${ds.maxWait}"/> <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 --> <property name="timeBetweenEvictionRunsMillis" value="${ds.timeBetweenEvictionRunsMillis}"/> <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 --> <property name="minEvictableIdleTimeMillis" value="${ds.minEvictableIdleTimeMillis}"/> <property name="validationQuery" value="${ds.validationQuery}"/> <property name="testWhileIdle" value="${ds.testWhileIdle}"/> <property name="testOnBorrow" value="${ds.testOnBorrow}"/> <property name="testOnReturn" value="${ds.testOnReturn}"/> <!-- 打开PSCache,并且指定每个连接上PSCache的大小,Oracle专用 --> <property name="poolPreparedStatements" value="${oracle.poolPreparedStatements}"/> <property name="maxOpenPreparedStatements" value="${oracle.maxOpenPreparedStatements}"/> <!-- 配置监控统计拦截的filters --> <property name="filters" value="${ds.filters}"/> <!--<property name="proxyFilters" value="${ds.proxyFilters}"/>--> </bean> </beans> <!-- production环境 --> <beans profile="production"> <context:property-placeholder ignore-resource-not-found="true" location="classpath*:properties/prodjdbc.properties"/> <!-- dataSource 配置 --> <bean id="druidDataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close"> <!-- 基本属性 url、user、password --> <property name="driverClassName" value="${oracle.driverClassName}"/> <property name="url" value="${oracle.url}"/> <property name="username" value="${oracle.username}"/> <property name="password" value="${oracle.password}"/> <!-- 配置初始化大小、最小、最大 --> <property name="initialSize" value="${ds.initialSize}"/> <property name="minIdle" value="${ds.minIdle}"/> <property name="maxActive" value="${ds.maxActive}"/> <!-- 配置获取连接等待超时的时间 --> <property name="maxWait" value="${ds.maxWait}"/> <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 --> <property name="timeBetweenEvictionRunsMillis" value="${ds.timeBetweenEvictionRunsMillis}"/> <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 --> <property name="minEvictableIdleTimeMillis" value="${ds.minEvictableIdleTimeMillis}"/> <property name="validationQuery" value="${ds.validationQuery}"/> <property name="testWhileIdle" value="${ds.testWhileIdle}"/> <property name="testOnBorrow" value="${ds.testOnBorrow}"/> <property name="testOnReturn" value="${ds.testOnReturn}"/> <!-- 打开PSCache,并且指定每个连接上PSCache的大小,Oracle专用 --> <property name="poolPreparedStatements" value="${oracle.poolPreparedStatements}"/> <property name="maxOpenPreparedStatements" value="${oracle.maxOpenPreparedStatements}"/> <!-- 配置监控统计拦截的filters --> <property name="filters" value="${ds.filters}"/> <!--<property name="proxyFilters" value="${ds.proxyFilters}"/>--> </bean> </beans> </beans>
<?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:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd" default-lazy-init="true"> <description>apache shiro配置</description> <bean id="shiroPropertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="order" value="2" /> <property name="ignoreUnresolvablePlaceholders" value="true" /> <property name="locations" value="classpath*:properties/shiro.properties"/> </bean> <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"> <property name="securityManager" ref="securityManager"/> <property name="loginUrl" value="/sign/view"/> <property name="successUrl" value="/"/> <property name="unauthorizedUrl" value="/error/error-auth?error=unauthor"/> <!--<property name="filters"> <util:map> <!–<entry key="authc" value-ref="formAuthenticationFilter"/>–> <!–<entry key="userSetting" value-ref="userSettingFilter"/>–> <entry key="authc" value-ref="customFormAuthFilter"/> </util:map> </property>--> <property name="filterChainDefinitions"> <value> /=anon /assets/**=anon /sign/view=anon /sign/login=anon /sign/logout=logout /captcha/**=anon /system/**=roles[admin] /**=authc </value> </property> </bean> <!-- 自定义filter 实现自定义session失效后重新设置 --> <bean id="customFormAuthFilter" class="com.focustech.micen.relational.security.FormAuthenticationCaptchaFilter"> <property name="usernameParam" value="loginName"/> <property name="passwordParam" value="password"/> <property name="loginUrl" value="login"/> </bean> <bean id="sha512Matcher" class="org.apache.shiro.authc.credential.HashedCredentialsMatcher"> <!-- md5 --> <property name="hashAlgorithmName" value="MD5"/> <!-- true means hex encoded, false means base64 encoded --> <property name="storedCredentialsHexEncoded" value="true"/> <!-- 迭代次数 --> <property name="hashIterations" value="2"/> </bean> <!-- 重写ldap认证 --> <bean id="openLdapRealmExt" class="com.focustech.micen.relational.security.JndiLdapRealmExt"> <property name="baseDn" value="CN=Users,DC=focuschina,DC=com"/> <property name="userDnTemplate" value="CN={0},CN=Users,DC=company,DC=com"/> <property name="contextFactory" ref="contextFactory"/> <!--<property name="credentialsMatcher" ref="sha512Matcher"/>--> </bean> <!-- 配置ldap路径及配置一个默认的用户和密码 --> <bean id="contextFactory" class="org.apache.shiro.realm.ldap.JndiLdapContextFactory"> <property name="url" value="ldap://ldap-proxy.vemic.com"/> <property name="systemUsername" value="ldapuser"/> <property name="systemPassword" value="7777"/> <!--<property name="authenticationMechanism" value=""/>--> </bean> <!-- 会话ID生成器 --> <bean id="sessionIdGenerator" class="org.apache.shiro.session.mgt.eis.JavaUuidSessionIdGenerator"/> <!-- 会话DAO --> <bean id="sessionDAO" class="org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO"> <property name="sessionIdGenerator" ref="sessionIdGenerator"/> </bean> <bean id="sessionValidationScheduler" class="org.apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler"> <!--<property name="sessionManager" ref="defaultWebSessionManager"/>--> <property name="interval" value="1800000"/><!--60000--> </bean> <!-- 会话管理器 --> <!-- default web session manager,session expire time 20 minutes --> <bean id="defaultWebSessionManager" class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager"> <property name="globalSessionTimeout" value="1800000"/><!--1800000--> <property name="deleteInvalidSessions" value="true"/> <!--<property name="sessionValidationInterval" value="1800000"/>--> <property name="sessionValidationSchedulerEnabled" value="true"/> <property name="sessionValidationScheduler" ref="sessionValidationScheduler"/> <property name="sessionDAO" ref="sessionDAO"/> <property name="sessionIdCookieEnabled" value="true"/> <property name="sessionIdCookie" ref="sessionIdCookie"/> </bean> <bean id="sessionIdCookie" class="org.apache.shiro.web.servlet.SimpleCookie"> <constructor-arg value="xsid"/> <property name="httpOnly" value="true"/> <property name="maxAge" value="-1"/> </bean> <bean id="rememberMeCookie" class="org.apache.shiro.web.servlet.SimpleCookie"> <constructor-arg value="rememberMe"/> <property name="httpOnly" value="true"/> <!-- 记住30天 --> <property name="maxAge" value="2592000"/> </bean> <!-- rememberMe管理器 --> <bean id="rememberMeManager" class="org.apache.shiro.web.mgt.CookieRememberMeManager"> <!-- rememberMe cookie加密的密钥 建议每个项目都不一样 默认AES算法 密钥长度(128 256 512 位) --> <!--<property name="cipherKey" value="#{T(org.apache.shiro.codec.Base64).decode(${shiro.cookie.base64.cipherKey})}"/>--> <property name="cipherKey" value="#{T(org.apache.shiro.codec.Base64).decode('4AvVhmFLUs0KTA3Kprsdag==')}"/> <property name="cookie" ref="rememberMeCookie"/> </bean> <!-- 安全管理器 --> <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"> <property name="realms"> <list> <ref bean="openLdapRealmExt"/> </list> </property> <!-- cacheManager,集合spring缓存工厂 --> <property name="cacheManager" ref="shiroEhcacheManager"/> <property name="sessionManager" ref="defaultWebSessionManager"/> <property name="rememberMeManager" ref="rememberMeManager"/> </bean> <!-- Shiro生命周期处理器 --> <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/> <!-- 开启Shiro的注解(如@RequiresRoles,@RequiresPermissions),需借助SpringAOP扫描使用Shiro注解的类,并在必要时进行安全逻辑验证 --> <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor"> <property name="proxyTargetClass" value="true"/> </bean> <bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor"> <property name="securityManager" ref="securityManager"/> </bean> <!-- 缓存管理器 使用Ehcache实现 --> <bean id="shiroEhcacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager"> <property name="cacheManagerConfigFile" value="classpath:cache/ehcache-shiro.xml"/> </bean> <!--<bean id="formAuthenticationFilter" class="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"/>--> </beans>
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:mongo="http://www.springframework.org/schema/data/mongo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> <!-- mongo db配置 --> <mongo:mongo host="localhost" port="27017"/> <!-- mongo的工厂,通过它来取得mongo实例,dbname为mongodb的数据库名,没有的话会自动创建 --> <mongo:db-factory dbname="test" mongo-ref="mongo"/> <!-- mongodb的主要操作对象,所有对mongodb的增删改查的操作都是通过它完成 --> <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"> <constructor-arg name="mongoDbFactory" ref="mongoDbFactory"/> </bean> <!-- 映射转换器,扫描back-package目录下的文件,根据注释,把它们作为mongodb的一个collection的映射 --> <mongo:mapping-converter base-package="com.company.basen.web.model.mongodb"/> <!-- mongodb bean的仓库目录,会自动扫描扩展了MongoRepository接口的接口进行注入 --> <mongo:repositories base-package="com.company.basen.web.service.mongodb"/> <context:annotation-config/> </beans>
<?xml version="1.0" encoding="UTF-8"?> <!-- status=debug 可以查看log4j的装配过程 --> <configuration status="off" monitorInterval="1800"> <properties> <property name="LOG_HOME">/tmp/logs/xweb</property> <!-- 日志备份目录 --> <property name="BACKUP_HOME">{LOG_HOME}/backup</property> <property name="STAT_NAME">stat</property> <property name="SERVER_NAME">micdap</property> </properties> <appenders> <!-- 控制台输出 --> <Console name="Console" target="SYSTEM_OUT" follow="true"> <PatternLayout pattern="[%-5level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger [%thread][%file:%line] - %msg%n"/> </Console> <!-- 调试日志 --> <RollingRandomAccessFile name="DevLog" fileName="${LOG_HOME}/${SERVER_NAME}" filePattern="${LOG_HOME}/${SERVER_NAME}.%d{yyyy-MM-dd-HH}.log"> <PatternLayout pattern="[%-5level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger [%thread][%file:%line] - %msg%n"/> <Policies> <TimeBasedTriggeringPolicy interval="1" modulate="true"/> </Policies> </RollingRandomAccessFile> <!-- 产品数据分析日志 --> <RollingRandomAccessFile name="ProductLog" fileName="${LOG_HOME}/${SERVER_NAME}_${STAT_NAME}" filePattern="${LOG_HOME}/${SERVER_NAME}_${STAT_NAME}.%d{yyyy-MM-dd-HH}.log"> <PatternLayout pattern="[%-5level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger [%thread][%file:%line] - %msg%n"/> <Policies> <TimeBasedTriggeringPolicy interval="1" modulate="true"/> </Policies> </RollingRandomAccessFile> </appenders> <loggers> <!-- 3rdparty Loggers --> <logger name="org.springframework.core" level="info"/> <logger name="org.springframework.beans" level="info"/> <logger name="org.springframework.context" level="info"/> <logger name="org.springframework.web" level="info"/> <logger name="org.jboss.netty" level="warn"/> <logger name="org.apache.http" level="warn"/> <!-- Game Stat logger --> <!--<logger name="com.company.basen" level="info" additivity="true"> <appender-ref ref="ProductLog"/> </logger>--> <!-- Root Logger --> <root level="DEBUG"> <appender-ref ref="DevLog"/> <appender-ref ref="Console"/> </root> </loggers> </configuration>
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> <generatorConfiguration> <classPathEntry location="/home/lincolnbro/Nexus/repo/com/oracle/ojdbc6/11.2.0.2.0/ojdbc6-11.2.0.2.0.jar"/> <context id="OracleTables" targetRuntime="MyBatis3"> <commentGenerator> <property name="suppressDate" value="false"/> <property name="suppressAllComments" value="true"/> </commentGenerator> <jdbcConnection driverClass="oracle.jdbc.OracleDriver" connectionURL="jdbc:oracle:thin:@192.168.1.110:1521:ora11" userId="dw" password="dw1234"> </jdbcConnection> <!--<jdbcConnection driverClass="oracle.jdbc.OracleDriver" connectionURL="jdbc:oracle:thin:@192.168.1.110:1521:ora11" userId="dw" password="dw1234"> </jdbcConnection>--> <javaTypeResolver> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> <!-- model --> <javaModelGenerator targetPackage="com.company.basen.relational.model" targetProject="src\main\java"> <property name="enableSubPackages" value="true"/> <property name="trimStrings" value="true"/> </javaModelGenerator> <!-- sqlMapper --> <sqlMapGenerator targetPackage="com.company.basen.relational.dao" targetProject="src\main\resources\mybatis\mapper"> <property name="enableSubPackages" value="true"/> </sqlMapGenerator> <!-- repostry --> <javaClientGenerator type="XMLMAPPER" targetPackage="com.focustech.micen.relational.dao" targetProject="src\main\java"> <property name="enableSubPackages" value="true"/> </javaClientGenerator> <!-- table, schema为数据库, tableName为表名, domainObjectName为对应的领域对象 --> <table tableName="BASE_IP" domainObjectName="IpInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> </table> </context> </generatorConfiguration>
##Oracle Global Setting oracle.driverClassName=oracle.jdbc.OracleDriver oracle.url=jdbc:oracle:thin:@192.168.5.110:1521:ora11 oracle.username=dw oracle.password=dw1234 oracle.poolPreparedStatements=true oracle.maxOpenPreparedStatements=100 ##DataSource Global Setting #配置 缺省值 说明 #name 配置这个属性的意义在于,如果存在多个数据源,监控的时候可以通过名字来区分开来。如果没有配置,将会生成一个名字,格式是:"DataSource-" + System.identityHashCode(this). 另外配置此属性至少在1.0.5版本中是不起作用的,强行设置name会出错,详情点此处。 ds.name=DataSource-192.168.50.35 #url 连接数据库的url,不同数据库不一样。例如:mysql : jdbc:mysql://10.20.153.104:3306/druid2 oracle : jdbc:oracle:thin:@10.20.149.85:1521:ocnauto #ds.url #username 连接数据库的用户名 #ds.username #password 连接数据库的密码。如果你不希望密码直接写在配置文件中,可以使用ConfigFilter。详细看这里:https://github.com/alibaba/druid/wiki/%E4%BD%BF%E7%94%A8ConfigFilter #ds.password #driverClassName 根据url自动识别 这一项可配可不配,如果不配置druid会根据url自动识别dbType,然后选择相应的driverClassName #ds.driverClassName #根据url自动识别 这一项可配可不配,如果不配置druid会根据url自动识别dbType,然后选择相应的driverClassName #initialSize 0 初始化时建立物理连接的个数。初始化发生在显示调用init方法,或者第一次getConnection时 ds.initialSize=1 #maxActive 8 最大连接池数量 ds.maxActive=50 #maxIdle 8 已经不再使用,配置了也没效果 ds.maxIdle=8 #minIdle 最小连接池数量 ds.minIdle=1 #maxWait 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置useUnfairLock属性为true使用非公平锁。 ds.maxWait=6000 #poolPreparedStatements false 是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql下建议关闭。 ds.poolPreparedStatements=false #maxOpenPreparedStatements -1 要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true。在Druid中,不会存在Oracle下PSCache占用内存过多的问题,可以把这个数值配置大一些,比如说100 ds.maxOpenPreparedStatements=-1 #validationQuery 用来检测连接是否有效的sql,要求是一个查询语句。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会其作用。 ds.validationQuery=select 1 from dual #testOnBorrow true 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 ds.testOnBorrow=false #testOnReturn false 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 ds.testOnReturn=false #testWhileIdle false 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。 ds.testWhileIdle=true #timeBetweenEvictionRunsMillis 有两个含义: 1) Destroy线程会检测连接的间隔时间 2) testWhileIdle的判断依据,详细看testWhileIdle属性的说明 ds.timeBetweenEvictionRunsMillis=600000 #ds.numTestsPerEvictionRun #不再使用,一个DruidDataSource只支持一个EvictionRun ds.minEvictableIdleTimeMillis=300000 #connectionInitSqls 物理连接初始化的时候执行的sql #ds.connectionInitSqls #exceptionSorter 根据dbType自动识别 当数据库抛出一些不可恢复的异常时,抛弃连接 #ds.exceptionSorter #属性类型是字符串,通过别名的方式配置扩展插件,常用的插件有: 监控统计用的filter:stat 日志用的filter:log4j 防御sql注入的filter:wall ds.filters=wall,stat,log4j2 #proxyFilters 类型是List<com.alibaba.druid.filter.Filter>,如果同时配置了filters和proxyFilters,是组合关系,并非替换关系 ds.proxyFilters=stat,log4j
##Oracle Global Setting oracle.driverClassName=oracle.jdbc.OracleDriver #oracle.url=jdbc:oracle:thin:@192.168.5.110:1521:ora11 #oracle.username=dw #oracle.password=dw1234 oracle.url=jdbc:oracle:thin:@192.168.68.10.110:5210:bi oracle.username=bi oracle.password=bi4321 oracle.poolPreparedStatements=true oracle.maxOpenPreparedStatements=100 ##DataSource Global Setting #配置 缺省值 说明 #name 配置这个属性的意义在于,如果存在多个数据源,监控的时候可以通过名字来区分开来。如果没有配置,将会生成一个名字,格式是:"DataSource-" + System.identityHashCode(this). 另外配置此属性至少在1.0.5版本中是不起作用的,强行设置name会出错,详情点此处。 ds.name=DataSource-192.168.68.60 #url 连接数据库的url,不同数据库不一样。例如:mysql : jdbc:mysql://10.20.153.104:3306/druid2 oracle : jdbc:oracle:thin:@10.20.149.85:1521:ocnauto #ds.url #username 连接数据库的用户名 #ds.username #password 连接数据库的密码。如果你不希望密码直接写在配置文件中,可以使用ConfigFilter。详细看这里:https://github.com/alibaba/druid/wiki/%E4%BD%BF%E7%94%A8ConfigFilter #ds.password #driverClassName 根据url自动识别 这一项可配可不配,如果不配置druid会根据url自动识别dbType,然后选择相应的driverClassName #ds.driverClassName #根据url自动识别 这一项可配可不配,如果不配置druid会根据url自动识别dbType,然后选择相应的driverClassName #initialSize 0 初始化时建立物理连接的个数。初始化发生在显示调用init方法,或者第一次getConnection时 ds.initialSize=1 #maxActive 8 最大连接池数量 ds.maxActive=50 #maxIdle 8 已经不再使用,配置了也没效果 ds.maxIdle=8 #minIdle 最小连接池数量 ds.minIdle=1 #maxWait 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置useUnfairLock属性为true使用非公平锁。 ds.maxWait=6000 #poolPreparedStatements false 是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql下建议关闭。 ds.poolPreparedStatements=false #maxOpenPreparedStatements -1 要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true。在Druid中,不会存在Oracle下PSCache占用内存过多的问题,可以把这个数值配置大一些,比如说100 ds.maxOpenPreparedStatements=-1 #validationQuery 用来检测连接是否有效的sql,要求是一个查询语句。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会其作用。 ds.validationQuery=select 1 from dual #testOnBorrow true 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 ds.testOnBorrow=false #testOnReturn false 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 ds.testOnReturn=false #testWhileIdle false 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。 ds.testWhileIdle=true #timeBetweenEvictionRunsMillis 有两个含义: 1) Destroy线程会检测连接的间隔时间 2) testWhileIdle的判断依据,详细看testWhileIdle属性的说明 ds.timeBetweenEvictionRunsMillis=600000 #ds.numTestsPerEvictionRun #不再使用,一个DruidDataSource只支持一个EvictionRun ds.minEvictableIdleTimeMillis=300000 #connectionInitSqls 物理连接初始化的时候执行的sql #ds.connectionInitSqls #exceptionSorter 根据dbType自动识别 当数据库抛出一些不可恢复的异常时,抛弃连接 #ds.exceptionSorter #属性类型是字符串,通过别名的方式配置扩展插件,常用的插件有: 监控统计用的filter:stat 日志用的filter:log4j 防御sql注入的filter:wall ds.filters=wall,stat,log4j2 #proxyFilters 类型是List<com.alibaba.druid.filter.Filter>,如果同时配置了filters和proxyFilters,是组合关系,并非替换关系 ds.proxyFilters=stat,log4j
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <!--<properties> <property name="dialectClass" value="com.focustech.core.feature.orm.dialect.MySql5Dialect"/> </properties>--> <!-- 配置mybatis的缓存,延迟加载等等一系列属性 --> <settings> <setting name="logImpl" value="LOG4J2"/> <!-- 全局映射器启用缓存 --> <setting name="cacheEnabled" value="true"/> <!-- 查询时,关闭关联对象即时加载以提高性能 --> <setting name="lazyLoadingEnabled" value="true"/> <!-- 对于未知的SQL查询,允许返回不同的结果集以达到通用的效果 --> <setting name="multipleResultSetsEnabled" value="true"/> <!-- 允许使用列标签代替列名 --> <setting name="useColumnLabel" value="true"/> <!-- 不允许使用自定义的主键值(比如由程序生成的UUID 32位编码作为键值),数据表的PK生成策略将被覆盖 --> <setting name="useGeneratedKeys" value="false"/> <!-- 给予被嵌套的resultMap以字段-属性的映射支持 FULL,PARTIAL --> <setting name="autoMappingBehavior" value="PARTIAL"/> <!-- 对于批量更新操作缓存SQL以提高性能 BATCH,SIMPLE --> <setting name="defaultExecutorType" value="BATCH"/> <!-- 数据库超过25000秒仍未响应则超时 --> <setting name="defaultStatementTimeout" value="25000"/> <!-- Allows using RowBounds on nested statements --> <setting name="safeRowBoundsEnabled" value="false"/> <!-- Enables automatic mapping from classic database column names A_COLUMN to camel case classic Java property names aColumn. --> <setting name="mapUnderscoreToCamelCase" value="true"/> <!-- MyBatis uses local cache to prevent circular references and speed up repeated nested queries. By default (SESSION) all queries executed during a session are cached. If localCacheScope=STATEMENT local session will be used just for statement execution, no data will be shared between two different calls to the same SqlSession. --> <setting name="localCacheScope" value="SESSION"/> <!-- Specifies the JDBC type for null values when no specific JDBC type was provided for the parameter. Some drivers require specifying the column JDBC type but others work with generic values like NULL, VARCHAR or OTHER. --> <setting name="jdbcTypeForNull" value="OTHER"/> <!-- Specifies which Object's methods trigger a lazy load --> <setting name="lazyLoadTriggerMethods" value="equals,clone,hashCode,toString"/> <!-- 设置关联对象加载的形态,此处为按需加载字段(加载字段由SQL指定),不会加载关联表的所有字段,以提高性能 --> <setting name="aggressiveLazyLoading" value="false"/> </settings> <typeAliases> <package name="com.company.micen.relational.model"/> </typeAliases> <!-- <plugins> <plugin interceptor="com.company.core.feature.orm.mybatis.PaginationResultSetHandlerInterceptor"/> <plugin interceptor="com.company.core.feature.orm.mybatis.PaginationStatementHandlerInterceptor"/> </plugins>--> </configuration>
<?xml version="1.0" encoding="UTF-8"?> <ehcache updateCheck="false" name="txswx-ehcache"> <diskStore path="java.io.tmpdir"/> <!-- DefaultCache setting. --> <defaultCache maxEntriesLocalHeap="10000" eternal="true" timeToIdleSeconds="300" timeToLiveSeconds="600" overflowToDisk="true" maxEntriesLocalDisk="100000"/> </ehcache>
<?xml version="1.0" encoding="UTF-8"?> <ehcache updateCheck="false" name="shiroCache"> <defaultCache maxElementsInMemory="10000" eternal="true" timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="false" diskPersistent="false" diskExpiryThreadIntervalSeconds="120"/> </ehcache>
最后,pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.focustech.micen</groupId> <artifactId>micdap</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>micdap Maven Webapp</name> <url>http://maven.apache.org</url> <properties> <!-- generic properties --> <java.version>1.6</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <!-- jsp --> <jsp.version>2.2</jsp.version> <!-- jstl --> <jstl.version>1.2</jstl.version> <!-- servlet --> <servlet.version>2.5</servlet.version> <!-- springframework --> <spring-framework.version>4.1.6.RELEASE</spring-framework.version> <spring.ldap.version>2.0.2.RELEASE</spring.ldap.version> <!-- spring-data-jpa --> <spring-data-jpa.version>1.7.2.RELEASE</spring-data-jpa.version> <!-- spring-data-mongodb --> <spring.mongodb.version>1.6.2.RELEASE</spring.mongodb.version> <!-- hibernate --> <hibernate.version>4.2.1.Final</hibernate.version> <!-- hibernate-validator --> <hibernate-validator.version>5.0.2.Final</hibernate-validator.version> <!-- logback --> <logback.version>1.1.2</logback.version> <!-- slf4j --> <slf4j.version>1.7.10</slf4j.version> <!-- log4j2 --> <log4j2.version>2.2</log4j2.version> <!-- Test --> <junit.version>4.11</junit.version> <!-- mockito --> <mockito.version>1.9.5</mockito.version> <!-- mysql --> <mysql.version>5.1.22</mysql.version> <!-- oracle --> <ojdbc.version>11.2.0.2.0</ojdbc.version> <!-- mongodb --> <mongo.java.version>2.13.0</mongo.java.version> <!-- mybatis --> <mybatis.version>3.2.8</mybatis.version> <!-- mybatis spring --> <mybatis.spring.version>1.2.2</mybatis.spring.version> <!-- template --> <thymeleaf.version>2.1.4.RELEASE</thymeleaf.version> <!-- freemarker --> <freemarker.version>2.3.22</freemarker.version> <!-- fastjson --> <fastjson.version>1.1.8</fastjson.version> <!-- jackson --> <jackson.version>2.5.1</jackson.version> <!-- echarts --> <echarts.version>2.2.0</echarts.version> <!-- gson --> <gson.version>2.2.4</gson.version> <!-- commons-lang3 --> <commons-lang3.version>3.3.2</commons-lang3.version> <!-- commons-filreupuload --> <commons-fileupload.version>1.3.1</commons-fileupload.version> <!-- commons-collections --> <commons-collections.version>3.1</commons-collections.version> <!-- commons-codec --> <commons-codec.version>1.9</commons-codec.version> <!-- aspectj --> <aspectj.version>1.8.5</aspectj.version> <!-- cglib --> <cglib.version>3.1</cglib.version> <!-- asm --> <asm.version>3.3.1</asm.version> <!-- druid --> <druid.version>1.0.13</druid.version> <!-- shiro --> <shiro.version>1.2.3</shiro.version> <!-- captcha --> <captcha.version>1.0-RC6</captcha.version> <!-- mybatis plugin --> <plugin.mybatis.generator>1.3.2</plugin.mybatis.generator> <!-- maven compile --> <plugin.maven-compiler>3.1</plugin.maven-compiler> <!-- guava --> <guava.version>18.0</guava.version> <!-- google.collections --> <google.collections.version>1.0</google.collections.version> <!-- netty --> <netty.version>4.0.25.Final</netty.version> <!-- ehcache --> <ehcache.version>2.9.1</ehcache.version> <!-- joda-time --> <joda-time.version>2.4</joda-time.version> <!-- yuicompressor --> <yuicompressor.version>1.5.1</yuicompressor.version> <!-- poi --> <poi.version>3.11</poi.version> <!-- jodd --> <jodd.version>3.6.5</jodd.version> <!-- jetty:9.2.0.v20140526/9.2.7.v20150116 --> <jetty.version>9.2.7.v20150116</jetty.version> <!-- jrebel-maven-plugin --> <jrebel-maven-plugin.version>1.1.5</jrebel-maven-plugin.version> </properties> <dependencies> <!-- servlet --> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>${jstl.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>${servlet.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>${jsp.version}</version> <scope>provided</scope> </dependency> <!-- JSR303 Bean Validator --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>${hibernate-validator.version}</version> </dependency> <!-- spring --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>${spring-framework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> <version>${spring-framework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>${spring-framework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring-framework.version}</version> <exclusions> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${spring-framework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring-framework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId> <version>${spring-framework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${spring-framework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${spring-framework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring-framework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring-framework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring-framework.version}</version> </dependency> <!--<dependency> <groupId>org.springframework.ldap</groupId> <artifactId>spring-ldap-core</artifactId> <version>${spring.ldap.version}</version> </dependency>--> <!-- aspectj --> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>${aspectj.version}</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>${aspectj.version}</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjtools</artifactId> <version>${aspectj.version}</version> </dependency> <!-- cglib --> <dependency> <groupId>cglib</groupId> <artifactId>cglib</artifactId> <version>${cglib.version}</version> </dependency> <dependency> <groupId>cglib</groupId> <artifactId>cglib-nodep</artifactId> <version>${cglib.version}</version> </dependency> <!-- asm --> <dependency> <groupId>asm</groupId> <artifactId>asm-all</artifactId> <version>${asm.version}</version> </dependency> <!-- mongodb spring --> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-mongodb</artifactId> <version>${spring.mongodb.version}</version> </dependency> <dependency> <groupId>org.mongodb</groupId> <artifactId>mongo-java-driver</artifactId> <version>${mongo.java.version}</version> </dependency> <!-- MySQL Driver --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql.version}</version> </dependency> <!-- ORACLE database driver --> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>${ojdbc.version}</version> </dependency> <!-- druid --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>${druid.version}</version> </dependency> <!-- mybatis --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>${mybatis.version}</version> </dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> <version>${mybatis.spring.version}</version> </dependency> <!-- thymeleaf --> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf</artifactId> <version>${thymeleaf.version}</version> </dependency> <!-- thymeleaf with spring 4.x --> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf-spring4</artifactId> <version>${thymeleaf.version}</version> </dependency> <!-- <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf-spring3</artifactId> <version>2.1.4.RELEASE</version> </dependency> --> <!-- freemarker --> <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> <version>${freemarker.version}</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>${fastjson.version}</version> </dependency> <!-- fastxml.jackson --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>${jackson.version}</version> </dependency> <!-- ecahrts --> <dependency> <groupId>com.github.abel533</groupId> <artifactId>ECharts</artifactId> <version>${echarts.version}</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>${gson.version}</version> </dependency> <!-- apache commons --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>${commons-lang3.version}</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>${commons-fileupload.version}</version> </dependency> <dependency> <groupId>apache-collections</groupId> <artifactId>commons-collections</artifactId> <version>${commons-collections.version}</version> </dependency> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>${commons-codec.version}</version> </dependency> <!-- google collections --> <!--<dependency> <groupId>com.google.collections</groupId> <artifactId>google-collections</artifactId> <version>${google.collections.version}</version> </dependency>--> <!-- google guava --> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>${guava.version}</version> </dependency> <!-- shiro --> <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-all</artifactId> <version>${shiro.version}</version> </dependency> <!-- captcha --> <dependency> <groupId>com.octo.captcha</groupId> <artifactId>jcaptcha-all</artifactId> <version>${captcha.version}</version> <exclusions> <exclusion> <groupId>quartz</groupId> <artifactId>quartz</artifactId> </exclusion> <exclusion> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> </exclusion> <exclusion> <groupId>commons-pool</groupId> <artifactId>commons-pool</artifactId> </exclusion> <exclusion> <groupId>hsqldb</groupId> <artifactId>hsqldb</artifactId> </exclusion> <exclusion> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> </exclusion> <exclusion> <groupId>concurrent</groupId> <artifactId>concurrent</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring</artifactId> </exclusion> <exclusion> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> </exclusion> <exclusion> <groupId>xerces</groupId> <artifactId>xmlParserAPIs</artifactId> </exclusion> </exclusions> </dependency> <!-- netty --> <dependency> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> <version>${netty.version}</version> </dependency> <!-- ehcache --> <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> <version>${ehcache.version}</version> </dependency> <!-- joda-time --> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>${joda-time.version}</version> </dependency> <!-- Test --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>${mockito.version}</version> </dependency> <!-- poi --> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>${poi.version}</version> </dependency> <!-- jodd --> <dependency> <groupId>org.jodd</groupId> <artifactId>jodd-core</artifactId> <version>${jodd.version}</version> </dependency> <!-- Logging with SLF4J & LogBack --> <!--<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>${slf4j.version}</version> </dependency>--> <!-- 代码直接调用log4j会被桥接到slf4j --> <!--<dependency> <groupId>org.slf4j</groupId> <artifactId>log4j-over-slf4j</artifactId> <version>${slf4j.version}</version> </dependency>--> <!-- 代码直接调用commons-logging会被桥接到slf4j --> <!--<dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> <version>${slf4j.version}</version> </dependency>--> <!-- 代码直接调用java.util.logging会被桥接到slf4j --> <!--<dependency> <groupId>org.slf4j</groupId> <artifactId>jul-to-slf4j</artifactId> <version>${slf4j.version}</version> </dependency> <dependency> <groupId>com.googlecode.log4jdbc</groupId> <artifactId>log4jdbc</artifactId> <version>1.2</version> <scope>runtime</scope> </dependency>--> <!-- logback --> <!--<dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>${logback.version}</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>${logback.version}</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-access</artifactId> <version>${logback.version}</version> </dependency> <dependency> <groupId>org.logback-extensions</groupId> <artifactId>logback-ext-spring</artifactId> <version>0.1.2</version> </dependency>--> <!-- log4j2 以及桥接到log4j2 --> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> <version>${log4j2.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>${log4j2.version}</version> </dependency> <!--<dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-web</artifactId> <version>${log4j2.version}</version> <scope>runtime</scope> </dependency>--> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-1.2-api</artifactId> <version>${log4j2.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-jcl</artifactId> <version>${log4j2.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl</artifactId> <version>${log4j2.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-jul</artifactId> <version>${log4j2.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-taglib</artifactId> <version>${log4j2.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-nosql</artifactId> <version>${log4j2.version}</version> </dependency> </dependencies> <build> <finalName>micdap</finalName> <plugins> <plugin> <groupId>net.alchim31.maven</groupId> <artifactId>yuicompressor-maven-plugin</artifactId> <version>${yuicompressor.version}</version> <executions> <execution> <goals> <goal>compress</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>${plugin.mybatis.generator}</version> <configuration> <verbose>true</verbose> <overwrite>true</overwrite> </configuration> </plugin> <!-- maven compile config--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>${plugin.maven-compiler}</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> <configuration> <warSourceExcludes>logs/**</warSourceExcludes> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> <configuration> <encoding>utf-8</encoding> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.9</version> <configuration> <skip>true</skip> </configuration> </plugin> <!-- jetty maven --> <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>${jetty.version}</version> <configuration> <webAppConfig> <!-- 指定 root context 在这里指定为${project.artifactId} 即 jetty, 那么访问时就用http://localized:8080/jetty 访问, 如果指定梶为test 就用http://localized:8080/test访问,更多信息,请查看jetty 插件官方文档 --> <contextPath>/${project.artifactId}</contextPath> </webAppConfig> <httpConnector> <port>9090</port> </httpConnector> <systemProperties> <systemProperty> <name>spring.profiles.active</name> <value>development</value> </systemProperty> </systemProperties> <!-- 指定额外需要监控变化的文件或文件夹,主要用于热部署中的识别文件更新 --> <scanTargetPatterns> <scanTargetPattern> <directory>src</directory> <includes> <include>*.java</include> <include>*.properties</include> <include>*.jsp</include> <include>*.js</include> <include>*.css</include> </includes> <!-- <excludes> <exclude>**/*.xml</exclude> <exclude>**/myspecial.properties</exclude> </excludes> --> </scanTargetPattern> </scanTargetPatterns> <!-- 指定监控的扫描时间间隔,0为关闭jetty自身的热部署,主要是为了使用jrebel --> <scanIntervalSeconds>0</scanIntervalSeconds> <!-- 指定web页面的文件夹 --> <webAppSourceDirectory>src/main/webapp</webAppSourceDirectory> </configuration> </plugin> <!-- integration jrebel --> <plugin> <groupId>org.zeroturnaround</groupId> <artifactId>jrebel-maven-plugin</artifactId> <version>${jrebel-maven-plugin.version}</version> <executions> <execution> <id>generate-rebel-xml</id> <phase>process-resources</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin> </plugins> <!-- maven resource file filter --> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> </resources> </build> <!--<repositories> <repository> <id>timger-hadoop</id> <name>Hadoop Releases</name> <url>http://repository.timger.info/content/repositories/releases/</url> </repository> <repository> <id>timger-repos</id> <name>timger Repos</name> <url>http://repository.timger.info/artifactory/cloudera-repos/</url> </repository> <repository> <id>maven-hadoop</id> <name>Hadoop Releases</name> <url>http://repository.cloudera.com/content/repositories/releases/</url> </repository> <repository> <id>cloudera-repos</id> <name>Cloudera Repos</name> <url>http://repository.cloudera.com/artifactory/cloudera-repos/</url> </repository> <repository> <id>oschina-repos</id> <name>oschina Repos</name> <url>http://maven.oschina.net/content/groups/public/</url> </repository> </repositories>--> <repositories> <repository> <id>oschina-repos</id> <name>oschina Repos</name> <url>http://maven.oschina.net/content/groups/public/</url> </repository> <repository> <id>nexus-koala</id> <name>Nexus koala</name> <url>http://nexus.openkoala.org/content/groups/public-releases/</url> </repository> <repository> <id>com.springsource.repository.maven.release</id> <url>http://maven.springframework.org/release/</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>oracleReleases</id> <name>Oracle Released Java Packages</name> <url>http://download.oracle.com/maven</url> </repository> <repository> <id>JBossRepo1</id> <name>Jboss1</name> <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url> </repository> <repository> <id>JBossRepo</id> <name>Jboss</name> <url>https://repository.jboss.org/nexus/content/repositories/releases/</url> </repository> <repository> <id>Sonatype</id> <name>Sonatype Repository</name> <url>http://repository.sonatype.org/content/groups/public/</url> <layout>default</layout> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> </project>