mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-04-05 17:37:53 +08:00
!195 sa-token-solon-plugin:调整适配代码,允许没有sa-token配置内容。
Merge pull request !195 from 西东/dev
This commit is contained in:
commit
bdcaecd5bc
@ -35,28 +35,30 @@ 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
|
||||
SaManager.setSaTokenContext(new SaContextForSolon());
|
||||
|
||||
//注入配置Bean
|
||||
SaTokenConfig saTokenConfig = Solon.cfg().getBean("sa-token", SaTokenConfig.class);
|
||||
SaManager.setConfig(saTokenConfig);
|
||||
if (saTokenConfig != null) {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user