mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-06-28 13:34:18 +08:00
将 Autowired 更换为更合适的 PostConstruct
This commit is contained in:
parent
579aee164a
commit
7ad13a1c9d
@ -191,7 +191,7 @@ sa-token-jwt 插件默认只为 `StpUtil` 注入 `StpLogicJwtFoxXxx` 实现,
|
|||||||
/**
|
/**
|
||||||
* 为 StpUserUtil 注入 StpLogicJwt 实现
|
* 为 StpUserUtil 注入 StpLogicJwt 实现
|
||||||
*/
|
*/
|
||||||
@Autowired
|
@PostConstruct
|
||||||
public void setUserStpLogic() {
|
public void setUserStpLogic() {
|
||||||
StpUserUtil.setStpLogic(new StpLogicJwtForSimple(StpUserUtil.TYPE));
|
StpUserUtil.setStpLogic(new StpLogicJwtForSimple(StpUserUtil.TYPE));
|
||||||
}
|
}
|
||||||
@ -207,7 +207,7 @@ public void setUserStpLogic() {
|
|||||||
/**
|
/**
|
||||||
* 自定义 SaJwtUtil 生成 token 的算法
|
* 自定义 SaJwtUtil 生成 token 的算法
|
||||||
*/
|
*/
|
||||||
@Autowired
|
@PostConstruct
|
||||||
public void setSaJwtTemplate() {
|
public void setSaJwtTemplate() {
|
||||||
SaJwtUtil.setSaJwtTemplate(new SaJwtTemplate() {
|
SaJwtUtil.setSaJwtTemplate(new SaJwtTemplate() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -89,7 +89,7 @@ public String info() {
|
|||||||
``` java
|
``` java
|
||||||
@Configuration
|
@Configuration
|
||||||
public class SaTokenConfigure {
|
public class SaTokenConfigure {
|
||||||
@Autowired
|
@PostConstruct
|
||||||
public void rewriteSaStrategy() {
|
public void rewriteSaStrategy() {
|
||||||
// 重写Sa-Token的注解处理器,增加注解合并功能
|
// 重写Sa-Token的注解处理器,增加注解合并功能
|
||||||
SaStrategy.instance.getAnnotation = (element, annotationClass) -> {
|
SaStrategy.instance.getAnnotation = (element, annotationClass) -> {
|
||||||
@ -167,7 +167,7 @@ public class StpUserUtil {
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class SaTokenConfigure {
|
public class SaTokenConfigure {
|
||||||
|
|
||||||
@Autowired
|
@PostConstruct
|
||||||
public void setSaTokenConfig() {
|
public void setSaTokenConfig() {
|
||||||
// 设定 StpUtil 使用的 SaTokenConfig 配置参数对象
|
// 设定 StpUtil 使用的 SaTokenConfig 配置参数对象
|
||||||
SaTokenConfig config1 = new SaTokenConfig();
|
SaTokenConfig config1 = new SaTokenConfig();
|
||||||
|
@ -48,7 +48,7 @@ public class SaTokenConfigure {
|
|||||||
/**
|
/**
|
||||||
* 重写 Sa-Token 框架内部算法策略
|
* 重写 Sa-Token 框架内部算法策略
|
||||||
*/
|
*/
|
||||||
@Autowired
|
@PostConstruct
|
||||||
public void rewriteSaStrategy() {
|
public void rewriteSaStrategy() {
|
||||||
// 重写 Token 生成策略
|
// 重写 Token 生成策略
|
||||||
SaStrategy.instance.createToken = (loginId, loginType) -> {
|
SaStrategy.instance.createToken = (loginId, loginType) -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user