springboot 项目配置sharding jdbc时候报错:Could not resolve placeholder springdatasourcedruidinitialSize in value $springdatasourcedruidinitialSize的解决方案
可以尝试检查以下几个方面:
-
检查配置文件是否正确引入了占位符所在的配置文件,例如在application.properties或application.yml中添加了以下语句:
spring.config.import=classpath:config/application-db.yml -
检查占位符的拼写是否正确,包括大小写和符号等。
-
检查占位符的值是否正确设置。可以在代码中通过
@Value注解来获取占位符的值,例如:@Value("${spring.datasource.druid.initialSize}") private int initialSize;如果能够成功获取占位符的值,说明配置文件中的占位符设置正确。
如果以上方法都没有解决问题,可以尝试重新启动项目或者重新配置数据库连接池。
原文地址: https://www.cveoy.top/t/topic/eCtd 著作权归作者所有。请勿转载和采集!