我有以下spring-boot 1.4.2.RELEASE示例应用程序
@SpringBootApplication
public class Application {
@Value("${spring.application.name}")
private String applicationName;
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
我在bootstrap.properties中定义了以下配置:
spring.application.name=sample-app
Run Code Online (Sandbox Code Playgroud)
运行时我收到以下错误:
java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.application.name' in string value "${spring.application.name}"
Run Code Online (Sandbox Code Playgroud)
有关为什么它无法注入'spring.application.name'的任何提示?需要在那里定义它以支持其他Spring引导云.