Closed wangzhiwei1314 closed 2 years ago
具体描述下场景,看起来是能合并的。 就是我还是不太理解场景。
当我在module A中引入dynamic-datasource-spring-boot-starter依赖后(版本3.4.1),如果application.yml配置文件中未显式声明spring.datasource.dynamic.enabled: false,启动程序时会报错:
Caused by: java.lang.RuntimeException: HikariConfig does not has 'copyState' or 'copyStateTo' method! at com.baomidou.dynamic.datasource.creator.HikariDataSourceCreator.fetchMethod(HikariDataSourceCreator.java:78) at com.baomidou.dynamic.datasource.creator.HikariDataSourceCreator.<clinit>(HikariDataSourceCreator.java:48) ... 133 common frames omitted
我希望能在不修改现有工程applicaiton.yml配置文件的情况下依赖module A(module A是底层模块,被多个模块依赖),但是由于DynamicDataSourceAutoConfiguration类中,@ConditionalOnProperty的matchIfMissing = true,所以会导致其他模块报错。
当我在module A中引入dynamic-datasource-spring-boot-starter依赖后(版本3.4.1),如果application.yml配置文件中未显式声明spring.datasource.dynamic.enabled: false,启动程序时会报错:
Caused by: java.lang.RuntimeException: HikariConfig does not has 'copyState' or 'copyStateTo' method! at com.baomidou.dynamic.datasource.creator.HikariDataSourceCreator.fetchMethod(HikariDataSourceCreator.java:78) at com.baomidou.dynamic.datasource.creator.HikariDataSourceCreator.<clinit>(HikariDataSourceCreator.java:48) ... 133 common frames omitted
我希望能在不修改现有工程applicaiton.yml配置文件的情况下依赖module A(module A是底层模块,被多个模块依赖),但是由于DynamicDataSourceAutoConfiguration类中,@ConditionalOnProperty的matchIfMissing = true,所以会导致其他模块报错。
那是不是会影响到所有人,用这个项目必须主动声明spring.datasource.dynamic.enabled: true
当我在module A中引入dynamic-datasource-spring-boot-starter依赖后(版本3.4.1),如果application.yml配置文件中未显式声明spring.datasource.dynamic.enabled: false,启动程序时会报错:
Caused by: java.lang.RuntimeException: HikariConfig does not has 'copyState' or 'copyStateTo' method! at com.baomidou.dynamic.datasource.creator.HikariDataSourceCreator.fetchMethod(HikariDataSourceCreator.java:78) at com.baomidou.dynamic.datasource.creator.HikariDataSourceCreator.<clinit>(HikariDataSourceCreator.java:48) ... 133 common frames omitted
我希望能在不修改现有工程applicaiton.yml配置文件的情况下依赖module A(module A是底层模块,被多个模块依赖),但是由于DynamicDataSourceAutoConfiguration类中,@ConditionalOnProperty的matchIfMissing = true,所以会导致其他模块报错。那是不是会影响到所有人,用这个项目必须主动声明spring.datasource.dynamic.enabled: true
嗯,确实会影响到其他人。如果大部分情况下都不配置spring.datasource.dynamic.enabled: true的话,把@ConditionalOnProperty中name = "enabled", havingValue = "true",matchIfMissing = true
去掉是不是就两全其美了,哈哈。
What kind of change does this PR introduce? (check at least one)
The description of the PR:
Other information: