spring.xml

<?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:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       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.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">


    <context:component-scan base-package="com.ylm.tujia">
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"></context:exclude-filter>
        <context:exclude-filter type="annotation" expression="org.springframework.web.bind.annotation.ControllerAdvice"></context:exclude-filter>
    </context:component-scan>

    <!--<context:property-placeholder location="classpath:dbConfig.properties"></context:property-placeholder>-->
    <bean id="propertyConfigurer"
          class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:redis.properties</value>
                <value>classpath:dbConfig.properties</value>
            </list>
        </property>
    </bean>

    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property>
        <property name="driverClass" value="${jdbc.driverClass}"></property>
        <property name="user" value="${jdbc.user}"></property>
        <property name="password" value="${jdbc.password}"></property>
        <property name="minPoolSize" value="${jdbc.minPoolSize}"></property>
        <property name="maxPoolSize" value="${jdbc.maxPoolSize}"></property>
        <property name="maxIdleTime" value="${jdbc.maxIdleTime}"></property>
        <!--<property name="maxStatements" value="${jdbc.maxStatements}"></property>-->
        <!--<property name="initialPoolSize" value="${jdbc.initialPoolSize}"></property>-->
        <!--<property name="idleConnectionTestPeriod" value="${jdbc.idleConnectionTestPeriod}"></property>-->
    </bean>

    <bean id="solrClient" class="org.apache.solr.client.solrj.impl.HttpSolrClient">
        <constructor-arg name="baseURL" value="http://localhost:8080/solr5/collection1"></constructor-arg>
    </bean>

    <!--mybatis相关-->

    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource"></property>
        <property name="mapperLocations" value="classpath:mapper/*Mapper.xml"></property>
        <property name="configLocation" value="classpath:mybatis.xml" />
        <!-- 配置分页插件 -->
        <property name="plugins">
            <array>
                <bean class="com.github.pagehelper.PageHelper">
                    <property name="properties">
                        <value>
                            dialect=mysql
                            reasonable=true
                        </value>
                    </property>
                </bean>
            </array>
        </property>
    </bean>
    <!--注意,在对应的dao接口上使用@MapperScan注解-->
    <bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="com.ylm.tujia.dao"></property>
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
    </bean>
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"></property>
    </bean>


    <!--shiro配置开始-->
    <!--<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"></bean>-->
    <!--&lt;!&ndash; 数据库保存的密码是使用MD5算法加密的,所以这里需要配置一个密码匹配对象 &ndash;&gt;-->
    <!--<bean id="credentialsMatcher" class="org.apache.shiro.authc.credential.Md5CredentialsMatcher"></bean>-->
    <!--&lt;!&ndash; 缓存管理 &ndash;&gt;-->
    <!--<bean id="cacheManager" class="org.apache.shiro.cache.MemoryConstrainedCacheManager"></bean>-->
    <!--&lt;!&ndash;-->
    <!--使用Shiro自带的JdbcRealm类-->
    <!--指定密码匹配所需要用到的加密对象-->
    <!--指定存储用户、角色、权限许可的数据源及相关查询语句-->
    <!--&ndash;&gt;-->
    <!--&lt;!&ndash;<bean id="jdbcRealm" class="org.apache.shiro.realm.jdbc.JdbcRealm">&ndash;&gt;-->
    <!--&lt;!&ndash;<property name="credentialsMatcher" ref="credentialsMatcher"></property>&ndash;&gt;-->
    <!--&lt;!&ndash;<property name="permissionsLookupEnabled" value="true"></property>&ndash;&gt;-->
    <!--&lt;!&ndash;<property name="dataSource" ref="dataSource"></property>&ndash;&gt;-->
    <!--&lt;!&ndash;</bean>&ndash;&gt;-->

    <!--<bean id="authsMySQLRealm" class="com.ylm.tujia.util.AuthsMySQLRealm">-->
    <!--</bean>-->
    <!--&lt;!&ndash; Shiro安全管理器 &ndash;&gt;-->
    <!--<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">-->
    <!--<property name="realm" ref="authsMySQLRealm"></property>-->
    <!--<property name="cacheManager" ref="cacheManager"></property>-->
    <!--</bean>-->
    <!--&lt;!&ndash;-->
    <!--Shiro主过滤器本身功能十分强大,其强大之处就在于它支持任何基于URL路径表达式的、自定义的过滤器的执行-->
    <!--Web应用中,Shiro可控制的Web请求必须经过Shiro主过滤器的拦截,Shiro对基于Spring的Web应用提供了完美的支持-->
    <!--&ndash;&gt;-->
    <!--<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">-->
    <!--&lt;!&ndash; Shiro的核心安全接口,这个属性是必须的 &ndash;&gt;-->
    <!--<property name="securityManager" ref="securityManager"></property>-->
    <!--&lt;!&ndash; 要求登录时的链接(登录页面地址),非必须的属性,默认会自动寻找Web工程根目录下的"/login.jsp"页面 &ndash;&gt;-->
    <!--<property name="loginUrl" value="/login"></property>-->
    <!--&lt;!&ndash; 登录成功后要跳转的连接(本例中此属性用不到,因为登录成功后的处理逻辑在LoginController里硬编码) &ndash;&gt;-->
    <!--&lt;!&ndash; <property name="successUrl" value="/" ></property> &ndash;&gt;-->
    <!--&lt;!&ndash; 用户访问未对其授权的资源时,所显示的连接 &ndash;&gt;-->
    <!--<property name="unauthorizedUrl" value="/"></property>-->
    <!--<property name="filterChainDefinitions">-->
    <!--<value>-->
    <!--/**=anon-->
    <!--</value>-->
    <!--</property>-->
    <!--</bean>-->
    <!--shiro配置结束-->

    <!-- redis数据源 -->
    <bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">
        <property name="maxIdle" value="${redis.maxIdle}" />
        <property name="maxTotal" value="${redis.maxActive}" />
        <property name="maxWaitMillis" value="${redis.maxWait}" />
        <property name="testOnBorrow" value="${redis.testOnBorrow}" />
    </bean>


    <!-- Spring-redis连接池管理工厂 -->
    <bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
        <property name="hostName" value="${redis.host}" />
        <property name="port" value="${redis.port}" />
        <property name="password" value="${redis.pass}" />
        <property name="timeout" value="${redis.timeout}" />
        <property name="poolConfig" ref="poolConfig" />
    </bean>
    <!-- 使用中间类解决RedisCache.jedisConnectionFactory的静态注入,从而使MyBatis实现第三方缓存 -->
    <bean id="redisCacheTransfer" class="com.ylm.tujia.util.RedisCacheTransfer">
        <property name="jedisConnectionFactory" ref="jedisConnectionFactory"/>
    </bean>

    <!--activiti配置开始-->
    <!--<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">-->
    <!--<property name="dataSource" ref="dataSource"></property>-->
    <!--<property name="transactionManager" ref="transactionManager"></property>-->
    <!--<property name="dbIdentityUsed" value="false"></property>-->
    <!--</bean>-->
    <!--<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">-->
    <!--<property name="processEngineConfiguration" ref="processEngineConfiguration"></property>-->
    <!--</bean>-->
    <!--<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService"></bean>-->
    <!--<bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService"></bean>-->
    <!--<bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService"></bean>-->
    <!--<bean id="taskService" factory-bean="processEngine" factory-method="getTaskService"></bean>-->
    <!--<bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"></bean>-->


    <!--hibernate相关-->
    <!--<bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">-->
    <!--<property name="dataSource" ref="dataSource"></property>-->
    <!--<property name="packagesToScan">-->
    <!--<list>-->
    <!--<value>com.ylm.day0630.entity</value>-->
    <!--</list>-->
    <!--</property>-->
    <!--<property name="hibernateProperties">-->
    <!--<props>-->
    <!--<prop key="hibernate.show_sql">true</prop>-->
    <!--<prop key="hibernate.format_sql">true</prop>-->
    <!--<prop key="hibernate.hbm2ddl.auto">update</prop>-->
    <!--<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>-->
    <!--<prop key="current_session_context_class">thread</prop>-->
    <!--</props>-->
    <!--</property>-->
    <!--</bean>-->
    <!--<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">-->
    <!--<property name="sessionFactory" ref="sessionFactory"></property>-->
    <!--</bean>-->

    <!--国际化-->
    <!--<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">-->
    <!--<property name="basename" value="message"></property>-->
    <!--</bean>-->

    <tx:annotation-driven></tx:annotation-driven>

</beans>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值