2016-09-13 4 views
0

タイトルとして、私はherokuにSpringブートアプリケーションを配備しようとしています。HerokuのSpringブートプロジェクトでapplication.ymlを使用できない

Under/resources私は@Valueアノテーションを使ってプロパティを注入するapplication.ymlファイルを持っています。起動中

は私がスタックトレースを取得しますが、私は、関連する部分が

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 。クライアントID'。

@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; 
    ... 
} 

私のapplication.ymlファイルをherokuで使用する方法についての手がかりはありますか?

+0

どのようにローカルでアプリを実行していますか? 'java -jar myapp.jar'やmvn/gradleコマンドのようなコマンドを使いますか? – codefinger

+0

私は「mvn spring-boot:run」または「mvn -B -DskipTests clean dependency:list install」のどちらかを使って、herokuも同じことを確認できます。 – user672009

+0

'java -jar'コマンド(' heroku ps'を実行したときに表示されるコマンド)のようにローカルで実行してみてください。私は問題を再現できると思っています。これは 'application.yml'がクラスパス上にないということです。 – codefinger

答えて

0

私のリポジトリにapplication.ymlファイルを含めるのを忘れた... doh!

関連する問題