baomidou / dynamic-datasource

dynamic datasource for springboot 多数据源 动态数据源 主从分离 读写分离 分布式事务
https://www.kancloud.cn/tracy5546/dynamic-datasource/2264611
Apache License 2.0
4.76k stars 1.2k forks source link

与shiro集成报错 #96

Closed ynp closed 4 years ago

ynp commented 5 years ago

`public class DynamicDataSourceAutoConfiguration {

@Autowired private DynamicDataSourceProperties properties; 。。。 @Bean @ConditionalOnMissingBean public DynamicDataSourceCreator dynamicDataSourceCreator() { DynamicDataSourceCreator dynamicDataSourceCreator = new DynamicDataSourceCreator(); dynamicDataSourceCreator.setDruidGlobalConfig(properties.getDruid()); ` properties 报空指针,无法注入。 shiro 在非DynamicDataSource 环境运行正常; DynamicDataSource在非shiro环境运行正常; 不知道您那有集成shiro成功的工程或者样例没有?

neozo commented 4 years ago

`public class DynamicDataSourceAutoConfiguration {

@Autowired private DynamicDataSourceProperties properties; 。。。 @bean @ConditionalOnMissingBean public DynamicDataSourceCreator dynamicDataSourceCreator() { DynamicDataSourceCreator dynamicDataSourceCreator = new DynamicDataSourceCreator(); dynamicDataSourceCreator.setDruidGlobalConfig(properties.getDruid()); ` properties 报空指针,无法注入。 shiro 在非DynamicDataSource 环境运行正常; DynamicDataSource在非shiro环境运行正常; 不知道您那有集成shiro成功的工程或者样例没有?

我也遇到了这个问题,你解决了没有

neozo commented 4 years ago

应该是配置有冲突,我在启动类上加了这个就可以, 具体原因不明 @SpringBootApplication(exclude = {ShiroAnnotationProcessorAutoConfiguration.class, DruidDataSourceAutoConfigure.class}) 🤣

zhaogituser commented 4 years ago

這倆個無關,不會影響。

xxyben commented 4 years ago

我也遇到了这个问题,还没解决,有没有人会解决呀????报错 java.lang.IllegalArgumentException: Can not set final java.lang.Class field com.baomidou.mybatisplus.core.override.MybatisMapperProxy.mapperInterface to org.springframework.aop.framework.JdkDynamicAopProxy at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:58) at sun.reflect.UnsafeQualifiedObjectFieldAccessorImpl.get(UnsafeQualifiedObjectFieldAccessorImpl.java:38) at java.lang.reflect.Field.get(Field.java:393) at com.baomidou.dynamic.datasource.DynamicDataSourceClassResolver.targetClass(DynamicDataSourceClassResolver.java:67) at com.baomidou.dynamic.datasource.aop.DynamicDataSourceAnnotationInterceptor.determineDatasource(DynamicDataSourceAnnotationInterceptor.java:60) at com.baomidou.dynamic.datasource.aop.DynamicDataSourceAnnotationInterceptor.invoke(DynamicDataSourceAnnotationInterceptor.java:51) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) at com.sun.proxy.$Proxy150.selectById(Unknown Source) at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.getById(ServiceImpl.java:238) at com.xxy.cloud2.service.sys.impl.SysSettingServiceImpl.getSysSettingByKey(SysSettingServiceImpl.java:80)

huayanYu commented 4 years ago

相关问题查看文档, 楼上问题新版会解决。