|
@@ -15,6 +15,7 @@ import com.api.annotation.LoginUser;
|
15
|
15
|
import com.api.entity.UserEntity;
|
16
|
16
|
import io.swagger.annotations.Api;
|
17
|
17
|
import io.swagger.annotations.ApiOperation;
|
|
18
|
+import org.springframework.beans.factory.BeanFactory;
|
18
|
19
|
import org.springframework.beans.factory.annotation.Autowired;
|
19
|
20
|
import org.springframework.context.ApplicationContext;
|
20
|
21
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -23,6 +24,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
23
|
24
|
import org.springframework.web.bind.annotation.RestController;
|
24
|
25
|
import springfox.documentation.annotations.ApiIgnore;
|
25
|
26
|
|
|
27
|
+import javax.servlet.http.HttpServletRequest;
|
|
28
|
+import javax.servlet.http.HttpSession;
|
|
29
|
+
|
26
|
30
|
/**
|
27
|
31
|
* 测试接口
|
28
|
32
|
*
|
|
@@ -34,7 +38,10 @@ import springfox.documentation.annotations.ApiIgnore;
|
34
|
38
|
public class ApiTestController extends AbsctactController {
|
35
|
39
|
@Autowired
|
36
|
40
|
ApplicationContext applicationContext;
|
37
|
|
-
|
|
41
|
+ @Autowired
|
|
42
|
+ BeanFactory beanFactory;
|
|
43
|
+ @Autowired
|
|
44
|
+ TokenDao tokenDao;
|
38
|
45
|
@Login
|
39
|
46
|
@GetMapping("userInfo")
|
40
|
47
|
@ApiOperation(value="获取用户信息", response=UserEntity.class)
|
|
@@ -51,10 +58,12 @@ public class ApiTestController extends AbsctactController {
|
51
|
58
|
|
52
|
59
|
@GetMapping("notToken")
|
53
|
60
|
@ApiOperation("忽略Token验证测试")
|
54
|
|
- public R notToken(){
|
55
|
|
- Object beanNamesForType = applicationContext.getBeanProvider(TokenDao.class);
|
|
61
|
+ public R notToken(HttpServletRequest request, HttpSession httpSession){
|
|
62
|
+ Object beanNamesForType = applicationContext.getBean(TokenDao.class);
|
|
63
|
+ TokenDao bean = beanFactory.getBean(TokenDao.class);
|
56
|
64
|
TokenDao tokenDao = (TokenDao) beanNamesForType;
|
57
|
|
- return R.ok().put("msg", "无需token也能访问。。。");
|
|
65
|
+// return R.ok().put("msg", "无需token也能访问。。。");
|
|
66
|
+ return R.ok().put( "无需token也能访问。。。");
|
58
|
67
|
}
|
59
|
68
|
|
60
|
69
|
}
|