Failed Autowired of BuildProperties Spring Boot 2.1.5 & eclipse

Tags: , ,

I’m creating a very simple application with a few REST API’s and it’s currently working correctly until I try to use the BuildProperties on my health check API. While starting my application I get the following error:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-06-17 09:54:29.210 ERROR 10796 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 



Field buildProperties in com.controller.HealthCheck required a bean of type '' that could not be found.

The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)

The following candidates were found but could not be injected:
    - Bean method 'buildProperties' in 'ProjectInfoAutoConfiguration' not loaded because @ConditionalOnResource did not find resource '${}'


Consider revisiting the entries above or defining a bean of type '' in your configuration.

I went to the build file and I also looked in the jar file created by the build and I see the is in fact there. In the jar file the path to the file is “BOOT-INFclassesMETA-INF”. I also have other “Autowired” elements that are not having issues.

Where my code fails:

public class HealthCheck {

    Environment environment;

    BuildProperties buildProperties;

    public HealthCheckResponse healthCheck() {
        return getHealthCheckResponse();

    private HealthCheckResponse getHealthCheckResponse(){
        HealthCheckResponse healthResponse = new HealthCheckResponse();
        String[] profiles = environment.getActiveProfiles();

        healthResponse.setServerTime(new Date());

        return healthResponse;

My gradle build file:

plugins {
    id 'org.asciidoctor.convert' version '1.5.3'
    id 'org.springframework.boot' version '2.1.5.RELEASE'
    id 'java'

apply plugin: 'io.spring.dependency-management'
apply plugin: 'eclipse'
apply plugin: 'java'

group = 'com'
version = '0.0.1'
sourceCompatibility = '12'

repositories {

ext {
    set('snippetsDir', file("build/generated-snippets"))

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-jersey'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'com.github.ulisesbocchio:jasypt-spring-boot-starter:2.1.1'
    runtimeOnly 'mysql:mysql-connector-java'
    annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.restdocs:spring-restdocs-webtestclient'
    testImplementation ''

test {
    outputs.dir snippetsDir

asciidoctor {
    inputs.dir snippetsDir
    dependsOn test

springBoot {

#Mon Jun 17 10:52:04 EDT 2019


As @Borislav Markov suggested I tried running it via command line and it seems to work perfectly regardless if I use JDK 12 or JDK 8. I think the issue has to do with the eclipse plugin I am using to run the application via the IDE.

Source: stackoverflow