Java Code Examples for org.apache.shiro.cache.ehcache.EhCacheManager#setCacheManagerConfigFile()

The following examples show how to use org.apache.shiro.cache.ehcache.EhCacheManager#setCacheManagerConfigFile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShiroConfig.java    From ruoyiplus with MIT License 6 votes vote down vote up
/**
 * 缓存管理器 使用Ehcache实现
 */
@Bean
public EhCacheManager getEhCacheManager()
{
    net.sf.ehcache.CacheManager cacheManager = net.sf.ehcache.CacheManager.getCacheManager("ruoyi");
    EhCacheManager em = new EhCacheManager();
    if (StringUtils.isNull(cacheManager))
    {
        em.setCacheManagerConfigFile("classpath:ehcache/ehcache-shiro.xml");
        return em;
    }
    else
    {
        em.setCacheManager(cacheManager);
        return em;
    }
}
 
Example 2
Source File: ShiroConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
/**
 * shiro缓存管理器;
 * 需要注入对应的其它的实体类中:
 * 安全管理器:securityManager
 *
 * @return
 */
@Bean(name="ehCacheManager")
@DependsOn("lifecycleBeanPostProcessor")
public EhCacheManager ehCacheManager() {
    log.info("ShiroConfiguration.getEhCacheManager()");
    EhCacheManager cacheManager = new EhCacheManager();
    cacheManager.setCacheManagerConfigFile("classpath:ehcache-shiro.xml");
    return cacheManager;
}
 
Example 3
Source File: ShiroConfig.java    From kvf-admin with MIT License 5 votes vote down vote up
/**
 * shiro缓存管理器。需要添加到securityManager中
 * @return cacheManager
 */
@Bean
public EhCacheManager ehCacheManager(){
    EhCacheManager cacheManager = new EhCacheManager();
    cacheManager.setCacheManagerConfigFile("classpath:ehcache.xml");
    return cacheManager;
}
 
Example 4
Source File: ShiroConfig.java    From springboot-learn with MIT License 5 votes vote down vote up
/**
 * 缓存管理器 使用Ehcache实现
 */
@Bean
public EhCacheManager getEhCacheManager() {
    CacheManager cacheManager = CacheManager.getCacheManager("shiro");
    EhCacheManager em = new EhCacheManager();
    if (StringUtils.isEmpty(cacheManager)) {
        em.setCacheManagerConfigFile("classpath:ehcache/ehcache-shiro.xml");
        return em;
    } else {
        em.setCacheManager(cacheManager);
        return em;
    }
}
 
Example 5
Source File: ShiroConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
/**
 * shiro缓存管理器;
 * 需要注入对应的其它的实体类中:
 * 安全管理器:securityManager
 *
 * @return
 */
@Bean(name="ehCacheManager")
@DependsOn("lifecycleBeanPostProcessor")
public EhCacheManager ehCacheManager() {
    log.info("ShiroConfiguration.getEhCacheManager()");
    EhCacheManager cacheManager = new EhCacheManager();
    cacheManager.setCacheManagerConfigFile("classpath:ehcache-shiro.xml");
    return cacheManager;
}
 
Example 6
Source File: ShiroConfiguration.java    From wangmarket with Apache License 2.0 5 votes vote down vote up
/** 
 * EhCacheManager , 缓存管理 
 * 用户登陆成功后 , 把用户信息和权限信息缓存起来 , 然后每次用户请求时 , 放入用户的session中 , 如果不设置这个bean , 每个请求都会查询一次数据库 . 
 */ 
@Bean 
@DependsOn("lifecycleBeanPostProcessor") 
public EhCacheManager ehCacheManager() { 
  EhCacheManager em = new EhCacheManager(); 
  em.setCacheManagerConfigFile("classpath:shiro-ehcache.xml");//配置文件路径 
  return em;
}
 
Example 7
Source File: ShiroAutoConfiguration.java    From spring-boot-shiro with Apache License 2.0 5 votes vote down vote up
@Bean(name = "cacheManager")
@ConditionalOnClass(name = {"org.apache.shiro.cache.ehcache.EhCacheManager"})
@ConditionalOnMissingBean(name = "cacheManager")
public CacheManager ehcacheManager() {
    EhCacheManager ehCacheManager = new EhCacheManager();
    ShiroProperties.Ehcache ehcache = properties.getEhcache();
    if (ehcache.getCacheManagerConfigFile() != null) {
        ehCacheManager.setCacheManagerConfigFile(ehcache.getCacheManagerConfigFile());
    }
    return ehCacheManager;
}
 
Example 8
Source File: ShiroAutoConfiguration.java    From utils with Apache License 2.0 5 votes vote down vote up
@Bean(name = "cacheManager")
@ConditionalOnClass(name = {"org.apache.shiro.cache.ehcache.EhCacheManager"})
@ConditionalOnMissingBean(name = "cacheManager")
public CacheManager ehcacheManager() {
    EhCacheManager ehCacheManager = new EhCacheManager();

    ShiroProperties.Ehcache ehcache = shiroProperties.getEhcache();
    if (ehcache.getConfigFile() != null) {
        ehCacheManager.setCacheManagerConfigFile(ehcache.getConfigFile());
    }

    return ehCacheManager;
}
 
Example 9
Source File: ShiroConfig.java    From SpringAll with MIT License 4 votes vote down vote up
@Bean
public EhCacheManager getEhCacheManager() {
    EhCacheManager em = new EhCacheManager();
    em.setCacheManagerConfigFile("classpath:config/shiro-ehcache.xml");
    return em;
}
 
Example 10
Source File: ShiroConfig.java    From SpringAll with MIT License 4 votes vote down vote up
@Bean
public EhCacheManager getEhCacheManager() {
	EhCacheManager em = new EhCacheManager();
	em.setCacheManagerConfigFile("classpath:config/shiro-ehcache.xml");
	return em;
}
 
Example 11
Source File: ShiroConfig.java    From SpringAll with MIT License 4 votes vote down vote up
@Bean
public EhCacheManager getEhCacheManager() {
    EhCacheManager em = new EhCacheManager();
    em.setCacheManagerConfigFile("classpath:config/shiro-ehcache.xml");
    return em;
}
 
Example 12
Source File: ShiroConfig.java    From yyblog with MIT License 4 votes vote down vote up
@Bean
public EhCacheManager ehCacheManager() {
    EhCacheManager em = new EhCacheManager();
    em.setCacheManagerConfigFile("classpath:config/ehcache.xml");
    return em;
}
 
Example 13
Source File: ShiroConfiguration.java    From spring-boot-quickstart with Apache License 2.0 4 votes vote down vote up
@Bean(name = "shiroEhcacheManager")
public EhCacheManager getEhCacheManager() {
    EhCacheManager em = new EhCacheManager();
    em.setCacheManagerConfigFile("classpath:ehcache/ehcache-shiro.xml");
    return em;
}
 
Example 14
Source File: ShiroConfig.java    From notes with Apache License 2.0 3 votes vote down vote up
/**
 * shiro缓存管理器;
 * 需要注入对应的其它的实体类中:
 * 1、安全管理器:securityManager
 * 可见securityManager是整个shiro的核心;
 *
 * @return
 */
@Bean
public EhCacheManager ehCacheManager() {
    EhCacheManager cacheManager = new EhCacheManager();
    cacheManager.setCacheManagerConfigFile("classpath:ehcache.xml");
    return cacheManager;
}
 
Example 15
Source File: ShiroConfig.java    From SpringBootBucket with MIT License 3 votes vote down vote up
/**
 * shiro缓存管理器;
 * 需要注入对应的其它的实体类中:
 * 1、安全管理器:securityManager
 * 可见securityManager是整个shiro的核心;
 *
 * @return
 */
@Bean
public EhCacheManager ehCacheManager() {
    EhCacheManager cacheManager = new EhCacheManager();
    cacheManager.setCacheManagerConfigFile("classpath:ehcache.xml");
    return cacheManager;
}
 
Example 16
Source File: ShiroConfig.java    From SpringBootBucket with MIT License 3 votes vote down vote up
/**
 * shiro缓存管理器;
 * 需要注入对应的其它的实体类中:
 * 1、安全管理器:securityManager
 * 可见securityManager是整个shiro的核心;
 *
 * @return
 */
@Bean
public EhCacheManager ehCacheManager() {
    EhCacheManager cacheManager = new EhCacheManager();
    cacheManager.setCacheManagerConfigFile("classpath:ehcache.xml");
    return cacheManager;
}