<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    沉睡森林@漂在北京

    本處文章除注明“轉載”外均為原創,轉載請注明出處。

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      152 隨筆 :: 4 文章 :: 114 評論 :: 0 Trackbacks
    xml代碼
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
        xmlns:cache
    ="http://www.springframework.org/schema/cache"  
        xmlns:p
    ="http://www.springframework.org/schema/p"  
        xsi:schemaLocation
    ="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd  
        http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"
    >  
        <cache:annotation-driven />  
        <!-- generic cache manager -->  
        <bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">  
            <property name="caches">  
                <set>  
                    <bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean" p:name="default"/>  
                    <bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean" p:name="sys_resource"/>  
                </set>  
            </property>  
        </bean>  
    </beans>  

    java代碼
    package org.jeasyweb.framework.sys_user.service;

    import java.util.Iterator;
    import java.util.Set;

    import org.jeasyweb.framework.sys_user.entity.SysResource;
    import org.junit.Test;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.test.context.ContextConfiguration;
    import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;

    @ContextConfiguration({ "classpath:applicationContext-dataSource.xml",
            "classpath:applicationContext-role.xml",
            "classpath:applicationContext-cache.xml" })
    public class UserServiceTest extends
            AbstractTransactionalJUnit4SpringContextTests {
        @Autowired
        UserService userService;

        @Test
        public void testHello() {
            Set<SysResource> resources = userService
                    .getResourceByUserId(new Long(1));
            Iterator<SysResource> it = resources.iterator();
        }

        @Test
        public void testCache() {
            Set<SysResource> resources2 = userService.getResourceByUserId(new Long(
                    1));
        }
    }

    service代碼
        @Override
        @Cacheable(value = "sys_resource", key = "'getResourceByUserId_' + #id")
        public Set<SysResource> getResourceByUserId(Long id) {
    //.



    posted on 2012-03-21 23:48 王總兵 閱讀(1763) 評論(0)  編輯  收藏 所屬分類: Spring
    主站蜘蛛池模板: 日本亚洲欧美色视频在线播放| 亚洲精品在线免费看| 亚洲爆乳大丰满无码专区| 国产卡二卡三卡四卡免费网址| 亚洲色成人网一二三区| 曰批全过程免费视频播放网站| 亚洲乱亚洲乱淫久久| 在线免费观看亚洲| 亚洲欧洲尹人香蕉综合| 7m凹凸精品分类大全免费| 亚洲美免无码中文字幕在线| 国产精品免费精品自在线观看| 亚洲国产成人va在线观看网址| 无码国产精品久久一区免费| 亚洲成a人无码亚洲成av无码| 四虎影视免费永久在线观看| 在线播放国产不卡免费视频| 亚洲乳大丰满中文字幕| 久99久精品免费视频热77| 亚洲第一成年人网站| 插B内射18免费视频| 美女视频黄频a免费观看| JLZZJLZZ亚洲乱熟无码| 嫩草在线视频www免费观看| 2022年亚洲午夜一区二区福利| 久久久久久久免费视频| 亚洲日韩国产一区二区三区在线 | 成人免费看黄20分钟| 亚洲精品精华液一区二区| 亚洲精品成人久久久| 2021国内精品久久久久精免费| 亚洲一卡2卡3卡4卡5卡6卡| 亚洲欧洲精品成人久久曰影片 | 成人黄色免费网站| 久久精品国产亚洲AV天海翼| 国产成人亚洲精品狼色在线 | 国产91在线免费| 成人A片产无码免费视频在线观看| 亚洲一区二区三区四区视频| 亚洲国产精品一区二区三区久久| 无码精品一区二区三区免费视频 |