v1.11.0 新特性:AOP注解鉴权

This commit is contained in:
shengzhang
2021-01-09 17:24:44 +08:00
parent 1028ac0fe6
commit fbff086ed9
10 changed files with 233 additions and 57 deletions

View File

@@ -3,6 +3,7 @@ package com.pj.test;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@@ -218,7 +219,19 @@ public class TestController {
}
// 测试 浏览器访问: http://localhost:8081/test/test
@Autowired
TestService TestService;
// 测试AOP注解鉴权 http://localhost:8081/test/testAOP
@RequestMapping("testAOP")
public AjaxJson testAOP() {
System.out.println("testAOP");
TestService.getList();
return AjaxJson.getSuccess();
}
// 测试 浏览器访问: http://localhost:8081/test/test
@RequestMapping("test")
public AjaxJson test() {
StpUtil.getTokenSession().logout();

View File

@@ -0,0 +1,26 @@
package com.pj.test;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Service;
import cn.dev33.satoken.annotation.SaCheckLogin;
/**
* 用来测试AOP注解鉴权
* @author kong
*
*/
@Service
//@SaCheckLogin
public class TestService {
@SaCheckLogin
public List<String> getList() {
System.out.println("getList");
return new ArrayList<String>();
}
}