Heroku上的Spring启动项目无法使用application.yml

时间:2016-09-13 12:28:33

标签: java spring heroku spring-boot

正如标题所述,我试图将弹簧启动应用程序部署到heroku。

在/ resources下我有一个application.yml文件,我使用@Value注释从中注入属性。

在启动过程中,我得到了一个堆栈跟踪,但我相信相关部分是下面的

Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private dk.fitfit.remotetexting.util.GoogleAuth dk.fitfit.remotetexting.api.controller.MessageController.googleAuth; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'googleAuth': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private dk.fitfit.remotetexting.business.service.ConfigurationService dk.fitfit.remotetexting.util.GoogleAuth.configurationService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String dk.fitfit.remotetexting.business.service.ConfigurationService.clientId; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'security.oauth2.client.clientId' in string value "${security.oauth2.client.clientId}"

基本上它说它无法创建我的ConfigurationService,因为它无法解析我的占位符&security.oauth2.client.clientId'。

@Service
public class ConfigurationService {
    @Value("${security.oauth2.client.clientId}")
    private String clientId;

    @Value("${fcm.auth_key}")
    private String AUTH_KEY_FCM;

    @Value("${fcm.api_url}")
    private String API_URL_FCM;
    ...
}

有关如何使heroku使用我的application.yml文件的任何线索?

1 个答案:

答案 0 :(得分:0)

我忘了在我的存储库中包含application.yml文件... doh!