package org.yzh.web.config; import com.github.benmanes.caffeine.cache.Caffeine; import org.mybatis.spring.annotation.MapperScan; import org.springframework.cache.CacheManager; import org.springframework.cache.caffeine.CaffeineCacheManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import java.util.concurrent.TimeUnit; @Configuration @ComponentScan("org.yzh.commons.spring,com.ruoyi.jt") @MapperScan("com.ruoyi.jt.mapper") public class BeanConfig { @Bean public CacheManager cacheManager() { CaffeineCacheManager manager = new CaffeineCacheManager(); manager.setCaffeine(Caffeine.newBuilder() .maximumSize(500L) .expireAfterWrite(30, TimeUnit.MINUTES)); return manager; } }