代码:
@Service
public class EmployeeService {
@Autowired
EmployeeMapper employeeMapper;
@Cacheable(cacheNames = {"emp"})
public Employee getEmp(Integer id){
System.out.println("查询"+id+"号员工");
return employeeMapper.getEmployee(id);
}
配置:
spring.datasource.url=jdbc:mysql://localhost:3306/spring_cache
spring.datasource.username=xxx
spring.datasource.password=xsg5207896
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
# 开启驼峰命名规则
mybatis.configuration.map-underscore-to-camel-case=true
logging.level.com.example.sbcache.mapper=debug
我看别人都是这么写的,为什么我的都不得行呢 求解 工具idea