標籤:ehcache hot ejb att file getc pos default 靜態
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:jaxws="http://cxf.apache.org/jaxws"
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
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
">
<context:property-placeholder location="classpath:db.properties"/>
<!-- 資料來源 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${jdbc.driverClass}"></property>
<property name="jdbcUrl" value="${jdbc.url}"></property>
<property name="user" value="${jdbc.user}"></property>
<property name="password" value="${jdbc.password}"></property>
</bean>
<!-- spring整合hibernate提供sessionFactory -->
<!-- <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
也可以通過注入hibernate配置資訊
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
掃描jpa實體所在包
<property name="packagesToScan">
<value>com.itheima.bos.domain</value>
</property>
</bean> -->
<!-- spring整合jpa -->
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- 掃描實體包路徑 -->
<property name="packagesToScan" value="com.itheima.bos.domain" />
<!-- 指定持久層提供者為Hibernate -->
<property name="persistenceProvider">
<bean class="org.hibernate.ejb.HibernatePersistence" />
</property>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<!-- 自動建表 -->
<property name="generateDdl" value="true" />
<property name="showSql" value="true" />
<property name="database" value="ORACLE" />
<property name="databasePlatform" value="org.hibernate.dialect.Oracle10gDialect" />
</bean>
</property>
<property name="jpaDialect">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
</property>
</bean>
<!-- 配置交易管理員 -->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"></property>
</bean>
<!-- 註解方式管理事務 -->
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
<!-- spring-data整合jpa :解放dao層,掃描dao層包-->
<jpa:repositories base-package="com.itheima.bos.dao"></jpa:repositories>
<!-- 組件掃描,識別註解 -->
<context:component-scan base-package="com.itheima.bos"/>
<!-- 配置遠程調用CRM用戶端的對象 -->
<jaxws:client id="customerClient" address="http://192.168.48.50:9091/bos_crm/service/customer?wsdl"
serviceClass="com.itheima.bos.crm.service.CustomerService" >
</jaxws:client>
<!-- 發布訂單服務 -->
<bean id="orderService" class="com.itheima.bos.service.take_delivery.OrderServiceImpl" />
<!-- 配置cxf服務端對象 -->
<jaxws:server id="bos" address="/order">
<jaxws:serviceBean>
<ref bean="orderService"/>
</jaxws:serviceBean>
</jaxws:server>
<!-- shiro環境配置 -->
<!-- 配置realm對象 -->
<bean id="bosRealm" class="com.itheima.bos.realm.BosRealm"></bean>
<!-- 配置shiro安全管理器的對象 -->
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<!-- 注入realm對象 -->
<property name="realm" ref="bosRealm"></property>
<!-- 注入緩衝管理器 -->
<property name="cacheManager" ref="cacheManager"></property>
</bean>
<!-- 配置ehcache緩衝管理器對象 -->
<bean id="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
<!-- 注入ehcache設定檔:配置緩衝策略 -->
<property name="cacheManagerConfigFile" value="classpath:ehcache.xml"></property>
</bean>
<!-- 配置shiro過濾器工廠,用於系統管理權限 -->
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
<!-- 注入安全管理器 -->
<property name="securityManager" ref="securityManager"></property>
<!-- loginUrl屬性用於url攔截授權時,若使用者未登入而訪問需要登入才能訪問的資源時,跳轉到後面配置的頁面 -->
<property name="loginUrl" value="/login.jsp"></property>
<!-- unauthotizedUrl屬性用於url攔截授權時,若使用者訪問未得到授權的資源時,跳轉到後面配置的頁面 -->
<property name="unauthorizedUrl" value="/unauthorized.jsp"></property>
<!-- 注入過濾器鏈 -->
<property name="filterChainDefinitions">
<value>
<!--
/**:表示多有請求
authc:表示認證通過才能訪問
anon:匿名過濾器,不需要使用者認證通過就能訪問,常用於訪問靜態資源和登入介面及用於登入的方法
perms:許可權過濾器,參數可以有多個,表示目前使用者必須具有所有包含的許可權才能訪問對應的URL或者方法
roles:角色過濾器,參數可以有多個,表示目前使用者必須具有所有包含的角色才能訪問對應的URL或者方法
-->
/login.jsp=anon
/css/**=anon
/js/**=anon
/images/**=anon
/validatecode.jsp=anon
/userAction_login.action=anon
/pages/base/standard.jsp = perms["stanardard_page"]
/courierAction_delteBatch.action = perms["courier_delete"]
/courierAction_update.action = perms["courier_update"]
/courierAction_save.action = perms["courier_save"]
/courierAction_page.action = perms["courier_page"]
/**=authc
</value>
</property>
</bean>
<!-- 使用註解的方式攔截授權,強制使用cglib代理,在service層使用shiro註解 -->
<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator">
<property name="proxyTargetClass" value="true"></property>
</bean>
<!-- 配置shiro的切面 -->
<bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor"></bean>
</beans>
ssh整合 applicationContext.xml 設定檔