簡體   English   中英

Heroku上的Spring Boot項目無法使用application.yml

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

如標題所示,我正在嘗試將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文件的任何線索嗎?

我忘了將application.yml文件包含在我的存儲庫中...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM