spring boot 启动错误:Could not resolve placeholder
2017-08-02 19:18
1036 查看
在启动整个spring boot项目时,出现错误:
Could not resolve placeholder
原因:没有指定好配置文件,因为src/main/resources下有多个配置文件,例如application-dev.properties, boss.properties等。
解决办法:
法1:
在application.properties中加入
spring.profiles.active=@env@
用来自动决定选择哪个配置文件。
法2:(不是好方法)
Could not resolve placeholder
原因:没有指定好配置文件,因为src/main/resources下有多个配置文件,例如application-dev.properties, boss.properties等。
解决办法:
法1:
在application.properties中加入
spring.profiles.active=@env@
用来自动决定选择哪个配置文件。
法2:(不是好方法)
@Configuration @EnableTransactionManagement // 自己添加的,指定配置文件 @PropertySource(value = "classpath:application-dev.properties", ignoreResourceNotFound = true) public class DruidDBConfig { private static final Logger LOG = LoggerFactory.getLogger(DruidDBConfig.class); @Value("${spring.datasource.url}") private String dbUrl; @Value("${spring.datasource.username}") private String username; 。。。 }
相关文章推荐
- spring boot 启动错误:Could not resolve placeholder
- 启动错误:Could not resolve placeholder 'spring.datasource.url' in value "${spring.datasource.url}"
- spring错误 Could not resolve Spring property placeholder
- 关于Spring-mybatis项目报Could not resolve placeholder错误的解决方法
- spring报“Could not resolve placeholder”错误
- spring错误<context:property-placeholder>:Could not resolve placeholder XXX in string value XXX
- spring报“Could not resolve placeholder”错误
- spring报“Could not resolve placeholder”错误,解决方案
- spring错误:<context:property-placeholder>:Could not resolve placeholder XXX in string value XXX
- Spring Boot之mvnw的启动错误Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
- spring boot could not resolve placeholder in string value 问题解决方法
- spring Could not resolve placeholder
- Spark集群启动python shell错误: Could not resolve hostname localhost: Temporary failure
- Spring中报"Could not resolve placeholder"的解决方案
- spring加载多个properties文件出现 Could not resolve placeholder
- Spring中报"Could not resolve placeholder"的解决方案
- spring报“Could not resolve placeholder”错误
- Spring 出现Could not resolve placeholder问题的解决方法
- Spring中报"Could not resolve placeholder"的解决方案
- Spring中报"Could not resolve placeholder"的解决方案