Skip to content

Commit d333ba5

Browse files
author
quding
committed
fix cache
1 parent 443442f commit d333ba5

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

SSM-Demo/src/main/java/cn/mrdear/service/BookService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@ public interface BookService {
1515
* 查询所有的books
1616
* @return 结果集
1717
*/
18-
@Cacheable(cacheNames = "bookcache")
1918
List<Book> findAll();
2019
}

SSM-Demo/src/main/java/cn/mrdear/service/impl/BookServiceImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cn.mrdear.service.impl;
22

3+
import org.springframework.cache.annotation.Cacheable;
34
import org.springframework.stereotype.Service;
45

56
import java.util.List;
@@ -21,6 +22,7 @@ public class BookServiceImpl implements BookService {
2122
private BookMapper bookMapper;
2223

2324
@Override
25+
@Cacheable(cacheNames = "bookcache")
2426
public List<Book> findAll() {
2527
List<Book> books = bookMapper.selectAll();
2628
System.out.println("测试缓存,如果缓存开启,多次请求则该方法会执行一次");

SSM-Demo/src/main/resources/spring/dispatcher-servlet.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@
6060
<!--</mvc:interceptors>-->
6161
<!--拦截器结束-->
6262

63-
<!-- 全局异常配置 -->
64-
<!--<bean id="exceptionResolver" class="cn.edu.aust.exception.exceptionSolver"/>-->
65-
6663

6764
<!-- 文件上传 -->
6865
<bean id="multipartResolver"

0 commit comments

Comments
 (0)