mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-06-28 13:34:18 +08:00
添加新经验
This commit is contained in:
parent
1f5798176d
commit
d8dc6f51cf
@ -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)
|
||||||
|
|
||||||
|
|
||||||
<!-- ---------------------------- 常见疑问 ----------------------------- -->
|
<!-- ---------------------------- 常见疑问 ----------------------------- -->
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user