sa-token-solon-plugin:调整适配代码,允许没有sa-token配置内容(给个默认的配置实例)。

This commit is contained in:
noear 2022-11-16 15:20:04 +08:00
parent 234b9d4089
commit 637781415a

View File

@ -35,19 +35,25 @@ public class XPluginImp implements Plugin {
public void start(AopContext context) {
// Sa-Token 日志输出 Bean
context.getBeanAsync(SaLog.class, bean -> {
SaManager.setLog(bean);
SaManager.setLog(bean);
});
//注入其它 Bean
context.beanOnloaded(c->{
context.beanOnloaded(c -> {
beanInitDo(c);
});
}
private void beanInitDo(AopContext context){
private void beanInitDo(AopContext context) {
//注入配置Bean
SaTokenConfig saTokenConfig = Solon.cfg().getBean("sa-token", SaTokenConfig.class);
if (saTokenConfig != null) {
//如果没有给个默认的
saTokenConfig = new SaTokenConfig();
saTokenConfig.setIsPrint(false);
}
SaManager.setConfig(saTokenConfig);
context.getBeanAsync(SaTokenConfig.class, bean -> {