!257 删除不必要检测代码

Merge pull request !257 from AppleOfGray/dev
This commit is contained in:
孔明 2023-07-04 01:25:50 +00:00 committed by Gitee
commit 78238641a3
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 19 additions and 4 deletions

View File

@ -438,6 +438,25 @@ spring.mvc.throw-exception-if-no-handler-found=true
### Q开启了懒加载后启动报“未能获取有效的上下文处理器”
开启了`lazy-initialization=true`后,启动报异常 `InvalidContextException`: 未能获取有效的上下文处理器, 配置如下:
``` yaml
spring:
main:
lazy-initialization: true
```
原因是sa-token自动配置入口类SaTokenContextRegister被延迟加载了只需要手动指定懒加载排除掉SaTokenContextRegister就可以了,实现代码如下:
```java
@Configuration
class MyConfiguration {
@Bean
LazyInitializationExcludeFilter integrationLazyInitExcludeFilter() {
return LazyInitializationExcludeFilter.forBeanTypes(SaTokenContextRegister.class);
}
}
```
[经验来源](https://gitee.com/dromara/sa-token/issues/I7EXIU)
<!-- ---------------------------- 常见疑问 ----------------------------- -->

View File

@ -74,10 +74,6 @@ public class SaAloneRedisInject implements EnvironmentAware{
if(saTokenDao == null || saTokenDao instanceof SaTokenDaoDefaultImpl) {
return;
}
// 如果配置文件不包含相关配置则不进行任何操作
if(environment.getProperty(ALONE_PREFIX + ".host") == null) {
return;
}
// ------------------- 开始注入