blade-boot配置多数据源启动报错2.8.2

Blade 未结 1 851
ywlong
ywlong 2021-12-15 18:05

一、该问题的重现步骤是什么?

  1. 启动系统报错,把application.yml的dynamic-datasource和dynamic-global改为true

    image.png


二、你期待的结果是什么?实际看到的又是什么?

期待的结果:能够正常启动进行测试

实际看到的是:启动报错java.io.FileNotFoundException: class path resource [com/baomidou/dynamic/datasource/spring/boot/autoconfigure/DynamicDataSourceCreatorAutoConfiguration.class] cannot be opened because it does not exist

但是我看maven里是有这个类的

image.png

三、你正在使用的是什么产品,什么版本?在什么操作系统上?

blade-boot2.8.2

windows


四、请提供详细的错误堆栈信息,这很重要。

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springblade.Application]; nested exception is java.io.FileNotFoundException: class path resource [com/baomidou/dynamic/datasource/spring/boot/autoconfigure/DynamicDataSourceCreatorAutoConfiguration.class] cannot be opened because it does not exist

at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:610)

at org.springframework.context.annotation.ConfigurationClassParser.access$800(ConfigurationClassParser.java:111)

at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.lambda$processGroupImports$1(ConfigurationClassParser.java:812)

at java.util.ArrayList.forEach(ArrayList.java:1249)

at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:809)

at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:780)

at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193)

at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:320)

at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:237)

at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:280)

at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96)

at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:755)

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:402)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)

at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140)

at org.springblade.core.launch.BladeApplication.run(BladeApplication.java:50)

at org.springblade.Application.main(Application.java:34)

Caused by: java.io.FileNotFoundException: class path resource [com/baomidou/dynamic/datasource/spring/boot/autoconfigure/DynamicDataSourceCreatorAutoConfiguration.class] cannot be opened because it does not exist

at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:187)

at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:55)

at org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:49)

at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)

at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:86)

at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:73)

at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81)

at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:696)

at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getRelated(ConfigurationClassParser.java:1090)

at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getAnnotationAttributes(ConfigurationClassParser.java:1071)

at org.springframework.context.annotation.ConfigurationClassParser.collectImports(ConfigurationClassParser.java:549)

at org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:522)

at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:311)

at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:250)

at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:600)

... 20 common frames omitted


五、若有更多详细信息,请在下面提供。

image.png

image.png

1条回答
  •  ywlong
    ywlong (楼主)
    2021-12-15 20:17

    已解决,自己引入的版本有问题,将dynamic-datasource-spring-boot-starter版本换到3.3.6即可解决

    image.png


    0 讨论(0)
提交回复