简体   繁体   English

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

[英]Spring boot project on Heroku unable to use application.yml

As the title states I'm trying to deploy a spring boot application to heroku. 如标题所示,我正在尝试将spring boot应用程序部署到heroku。

Under /resources I have an application.yml file from which I inject properties using @Value annotation. 在/ resources下,我有一个application.yml文件,使用@Value批注从该文件中注入属性。

During boot I get a stacktrace but I believe the relevant part is the below 在启动过程中,我得到了一个堆栈跟踪,但是我相信相关的部分如下

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}"

Basically it says it can't create my ConfigurationService because it can't resolve my placeholder '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;
    ...
}

Any clues about how to make heroku use my application.yml file? 关于如何使heroku使用我的application.yml文件的任何线索吗?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM