mirror of
https://gitee.com/dromara/sa-token.git
synced 2026-02-27 16:50:24 +08:00
移除 SaLogInput 组件
This commit is contained in:
+13
-26
@@ -19,7 +19,6 @@ import cn.dev33.satoken.json.SaJsonTemplate;
|
||||
import cn.dev33.satoken.listener.SaTokenEventCenter;
|
||||
import cn.dev33.satoken.listener.SaTokenListener;
|
||||
import cn.dev33.satoken.log.SaLog;
|
||||
import cn.dev33.satoken.log.input.SaLogInput;
|
||||
import cn.dev33.satoken.same.SaSameTemplate;
|
||||
import cn.dev33.satoken.sign.SaSignTemplate;
|
||||
import cn.dev33.satoken.stp.StpInterface;
|
||||
@@ -37,15 +36,23 @@ import cn.dev33.satoken.temp.SaTempInterface;
|
||||
public class SaBeanInject {
|
||||
|
||||
/**
|
||||
* 注入配置Bean
|
||||
* 组件注入
|
||||
* <p> 为确保 Log 组件正常打印,必须将 SaLog 和 SaTokenConfig 率先初始化 </p>
|
||||
*
|
||||
* @param saTokenConfig 配置对象
|
||||
*/
|
||||
@Autowired(required = false)
|
||||
public void setConfig(SaTokenConfig saTokenConfig) {
|
||||
SaManager.setConfig(saTokenConfig);
|
||||
public SaBeanInject(
|
||||
@Autowired(required = false) SaLog log,
|
||||
@Autowired(required = false) SaTokenConfig saTokenConfig
|
||||
){
|
||||
if(log != null) {
|
||||
SaManager.setLog(log);
|
||||
}
|
||||
if(saTokenConfig != null) {
|
||||
SaManager.setConfig(saTokenConfig);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 注入持久化Bean
|
||||
*
|
||||
@@ -156,26 +163,6 @@ public class SaBeanInject {
|
||||
SaManager.setSaSignTemplate(saSignTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注入自定义的 日志输出 Bean
|
||||
*
|
||||
* @param log /
|
||||
*/
|
||||
@Autowired(required = false)
|
||||
public void setLog(SaLog log) {
|
||||
SaManager.setLog(log);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注入自定义的 日志接受 Bean
|
||||
*
|
||||
* @param logInput /
|
||||
*/
|
||||
@Autowired(required = false)
|
||||
public void setLogInput(SaLogInput logInput) {
|
||||
SaManager.setLogInput(logInput);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注入自定义的 StpLogic
|
||||
* @param stpLogic /
|
||||
|
||||
+1
-10
@@ -5,7 +5,6 @@ import org.springframework.context.annotation.Bean;
|
||||
|
||||
import cn.dev33.satoken.config.SaTokenConfig;
|
||||
import cn.dev33.satoken.context.SaTokenContext;
|
||||
import cn.dev33.satoken.context.SaTokenContextForThreadLocal;
|
||||
import cn.dev33.satoken.json.SaJsonTemplate;
|
||||
import cn.dev33.satoken.reactor.spring.json.SaJsonTemplateForJackson;
|
||||
|
||||
@@ -35,15 +34,7 @@ public class SaBeanRegister {
|
||||
*/
|
||||
@Bean
|
||||
public SaTokenContext getSaTokenContext() {
|
||||
return new SaTokenContextForThreadLocal() {
|
||||
/**
|
||||
* 重写路由匹配方法
|
||||
*/
|
||||
@Override
|
||||
public boolean matchPath(String pattern, String path) {
|
||||
return SaPathMatcherHolder.getPathMatcher().match(pattern, path);
|
||||
}
|
||||
};
|
||||
return new SaTokenContextForSpringReactor();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package cn.dev33.satoken.reactor.spring;
|
||||
|
||||
import cn.dev33.satoken.context.SaTokenContextForThreadLocal;
|
||||
|
||||
/**
|
||||
* Sa-Token 上下文处理器 [ Spring Reactor 版本实现 ]
|
||||
*
|
||||
* @author kong
|
||||
*
|
||||
*/
|
||||
public class SaTokenContextForSpringReactor extends SaTokenContextForThreadLocal {
|
||||
|
||||
/**
|
||||
* 重写路由匹配方法
|
||||
*/
|
||||
@Override
|
||||
public boolean matchPath(String pattern, String path) {
|
||||
return SaPathMatcherHolder.getPathMatcher().match(pattern, path);
|
||||
}
|
||||
|
||||
}
|
||||
+6
-13
@@ -16,7 +16,6 @@ import cn.dev33.satoken.json.SaJsonTemplate;
|
||||
import cn.dev33.satoken.listener.SaTokenEventCenter;
|
||||
import cn.dev33.satoken.listener.SaTokenListener;
|
||||
import cn.dev33.satoken.log.SaLog;
|
||||
import cn.dev33.satoken.log.input.SaLogInput;
|
||||
import cn.dev33.satoken.same.SaSameTemplate;
|
||||
import cn.dev33.satoken.sign.SaSignTemplate;
|
||||
import cn.dev33.satoken.solon.model.SaContextForSolon;
|
||||
@@ -36,8 +35,10 @@ public class XPluginImp implements Plugin {
|
||||
public void start(AopContext context) {
|
||||
//集成初始化
|
||||
|
||||
// 注入上下文Bean
|
||||
SaManager.setSaTokenContext(new SaContextForSolon());
|
||||
// Sa-Token 日志输出 Bean
|
||||
context.getBeanAsyn(SaLog.class, bean -> {
|
||||
SaManager.setLog(bean);
|
||||
});
|
||||
|
||||
//注入配置Bean
|
||||
SaTokenConfig saTokenConfig = Solon.cfg().getBean("sa-token", SaTokenConfig.class);
|
||||
@@ -47,6 +48,8 @@ public class XPluginImp implements Plugin {
|
||||
SaManager.setConfig(bean);
|
||||
});
|
||||
|
||||
// 注入上下文Bean
|
||||
SaManager.setSaTokenContext(new SaContextForSolon());
|
||||
|
||||
// 注入Dao Bean
|
||||
context.getBeanAsyn(SaTokenDao.class, bean -> {
|
||||
@@ -104,16 +107,6 @@ public class XPluginImp implements Plugin {
|
||||
SaManager.setSaSignTemplate(bean);
|
||||
});
|
||||
|
||||
// Sa-Token 日志输出 Bean
|
||||
context.getBeanAsyn(SaLog.class, bean -> {
|
||||
SaManager.setLog(bean);
|
||||
});
|
||||
|
||||
// Sa-Token 日志接受 Bean
|
||||
context.getBeanAsyn(SaLogInput.class, bean -> {
|
||||
SaManager.setLogInput(bean);
|
||||
});
|
||||
|
||||
// 自定义 StpLogic 对象
|
||||
context.getBeanAsyn(StpLogic.class, bean -> {
|
||||
StpUtil.setStpLogic(bean);
|
||||
|
||||
+13
-26
@@ -19,7 +19,6 @@ import cn.dev33.satoken.json.SaJsonTemplate;
|
||||
import cn.dev33.satoken.listener.SaTokenEventCenter;
|
||||
import cn.dev33.satoken.listener.SaTokenListener;
|
||||
import cn.dev33.satoken.log.SaLog;
|
||||
import cn.dev33.satoken.log.input.SaLogInput;
|
||||
import cn.dev33.satoken.same.SaSameTemplate;
|
||||
import cn.dev33.satoken.sign.SaSignTemplate;
|
||||
import cn.dev33.satoken.stp.StpInterface;
|
||||
@@ -37,15 +36,23 @@ import cn.dev33.satoken.temp.SaTempInterface;
|
||||
public class SaBeanInject {
|
||||
|
||||
/**
|
||||
* 注入配置Bean
|
||||
* 组件注入
|
||||
* <p> 为确保 Log 组件正常打印,必须将 SaLog 和 SaTokenConfig 率先初始化 </p>
|
||||
*
|
||||
* @param saTokenConfig 配置对象
|
||||
*/
|
||||
@Autowired(required = false)
|
||||
public void setConfig(SaTokenConfig saTokenConfig) {
|
||||
SaManager.setConfig(saTokenConfig);
|
||||
public SaBeanInject(
|
||||
@Autowired(required = false) SaLog log,
|
||||
@Autowired(required = false) SaTokenConfig saTokenConfig
|
||||
){
|
||||
if(log != null) {
|
||||
SaManager.setLog(log);
|
||||
}
|
||||
if(saTokenConfig != null) {
|
||||
SaManager.setConfig(saTokenConfig);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 注入持久化Bean
|
||||
*
|
||||
@@ -156,26 +163,6 @@ public class SaBeanInject {
|
||||
SaManager.setSaSignTemplate(saSignTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注入自定义的 日志输出 Bean
|
||||
*
|
||||
* @param log /
|
||||
*/
|
||||
@Autowired(required = false)
|
||||
public void setLog(SaLog log) {
|
||||
SaManager.setLog(log);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注入自定义的 日志接受 Bean
|
||||
*
|
||||
* @param logInput /
|
||||
*/
|
||||
@Autowired(required = false)
|
||||
public void setLogInput(SaLogInput logInput) {
|
||||
SaManager.setLogInput(logInput);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注入自定义的 StpLogic
|
||||
* @param stpLogic /
|
||||
|
||||
Reference in New Issue
Block a user