sa-token-solon-plugin:调整适配代码,允许没有sa-token配置内容。

This commit is contained in:
noear 2022-11-16 15:38:55 +08:00
parent c2ad8bf347
commit 59eaed193b

View File

@ -46,23 +46,19 @@ public class XPluginImp implements Plugin {
}
private void beanInitDo(AopContext context) {
// 注入上下文Bean
SaManager.setSaTokenContext(new SaContextForSolon());
//注入配置Bean
SaTokenConfig saTokenConfig = Solon.cfg().getBean("sa-token", SaTokenConfig.class);
if (saTokenConfig == null) {
//如果没有给个默认的
saTokenConfig = new SaTokenConfig();
saTokenConfig.setIsPrint(false);
if (saTokenConfig != null) {
SaManager.setConfig(saTokenConfig);
}
SaManager.setConfig(saTokenConfig);
context.getBeanAsync(SaTokenConfig.class, bean -> {
SaManager.setConfig(bean);
});
// 注入上下文Bean
SaManager.setSaTokenContext(new SaContextForSolon());
// 注入Dao Bean
context.getBeanAsync(SaTokenDao.class, bean -> {
SaManager.setSaTokenDao(bean);