一、该问题的重现步骤是什么?
1. 在blade中创建自己的项目模块
2. 在nacos上编写该模块的配置文件,配置文件名为 candy-flowable-dev.yaml
#放行配置 blade: datasource: candy: master: url: jdbc:mysql://localhost:3306/flowable?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8 username: root password: 123456
3.在项目中编写 LauncherService的实现类
FlowableLauncherServiceImpl LauncherService { (SpringApplicationBuilder builderString appNameString profile) { Properties props = System.()PropsUtil.(propsNacosConstant.(profile))PropsUtil.(propsNacosConstant.)PropsUtil.(propsNacosConstant.)} () { } }
4.启动项目,报错
Caused by: java.lang.IllegalStateException: dbType not support : null, url ${blade.datasource.candy.master.url} at com.alibaba.druid.wall.WallFilter.init(WallFilter.java:166) at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:839) at com.baomidou.dynamic.datasource.DynamicDataSourceCreator.createDruidDataSource(DynamicDataSourceCreator.java:288) at com.baomidou.dynamic.datasource.DynamicDataSourceCreator.createDataSource(DynamicDataSourceCreator.java:154) at com.baomidou.dynamic.datasource.provider.AbstractDataSourceProvider.createDataSourceMap(AbstractDataSourceProvider.java:42) at com.baomidou.dynamic.datasource.provider.YmlDynamicDataSourceProvider.loadDataSources(YmlDynamicDataSourceProvider.java:47) at com.baomidou.dynamic.datasource.DynamicRoutingDataSource.afterPropertiesSet(DynamicRoutingDataSource.java:205) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790) ... 86 common frames omitted
二、你期待的结果是什么?实际看到的又是什么?
期待的结果是可以正常访问配置文件,实际上报错
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
blade开源项目,在win10系统
四、请提供详细的错误堆栈信息,这很重要。
五、若有更多详细信息,请在下面提供。
启动器尝试增加如下代码
public class DemoLauncherServiceImpl implements LauncherService { @Override public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) { Properties props = System.getProperties(); PropsUtil.setProperty(props, "spring.cloud.nacos.config.ext-config[0].data-id", "candy-flowable-dev.yaml"); PropsUtil.setProperty(props, "spring.cloud.nacos.config.ext-config[0].group", "DEFAULT_GROUP"); PropsUtil.setProperty(props, "spring.cloud.nacos.config.ext-config[0].refresh", "true"); } @Override public int getOrder() { return 20; } }
谢谢解答,我在resource下添加了这个就可以了
扫一扫访问 Blade技术社区 移动端