81,091
社区成员
发帖
与我相关
我的任务
分享
@CacheConfig
public interface UserDao {
@Cacheable( cacheNames = "users" )
User selectByPrimaryKey(String uid);
}
public interface UserSerevice {
public User showUsers(String uid);
}
@Service
public class UserServiceImp implements UserSerevice {
@Autowired
private UserDao userDao;
@Override
public User showUsers(String uid){
return userDao.selectByPrimaryKey(uid);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
updateCheck="false">
<diskStore path="java.io.tmpdir/Tmp_EhCache" />
<defaultCache
eternal="false"
maxElementsInMemory="1000"
overflowToDisk="false"
diskPersistent="false"
timeToIdleSeconds="0"
timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LRU" />
<cache name="users"
maxEntriesLocalHeap="200"
timeToLiveSeconds="600">
</cache>
</ehcache>
spring:
datasource:
url: jdbc:mysql://localhost:3306/shiro
username: root
password: root
thymeleaf:
cache: true
check-template-location: true
content-type: text/html
enabled: true
encoding: utf-8
mode: HTML5
prefix: classpath:/templates/
suffix: .html
cache:
ehcache:
config: classpath:/ehcache.xml
debug:
true
mybatis:
mapper-locations: classpath:/mapping/*Mapper.xml
# 打印sql
logging:
level:
com.example.demo.dao : debug