user672009
user672009

Reputation: 4585

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.

Under /resources I have an application.yml file from which I inject properties using @Value annotation.

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'.

@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?

Upvotes: 1

Views: 725

Answers (1)

user672009
user672009

Reputation: 4585

I forgot to include application.yml file in my repository... doh!

Upvotes: 1

Related Questions