You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Versions used
Spring boot 2.6.4
Java 17
Gradle 7.4
Description of the bug
Starting from Spring boot 2.6.4 the build-info.properties file is generated in a different path causing the application to fail when it's deployed in a servlet container and you are using a BuildProperties bean.
demo_264-app-1 | Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'helloWorldController' defined in file [/usr/local/tomcat/webapps/demo/WEB-INF/classes/com/example/demo/HelloWorldController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.boot.info.BuildProperties' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
Download both projects (basically they are the same project just changing the Spring boot version) and run the following command in both of them. After it finishes you can compare the wars created under build/libs folder and check that the path of the file is different.
$ ./gradlew bootWar
Also, to check the error produced when you run the war created by the project on a servlet container, you can find a docker-compose file that you can execute after generating the wars, and you will see the error at startup on the version using Spring boot 2.6.4
$ ./gradlew bootWar
$ docker compose up
The text was updated successfully, but these errors were encountered:
AlbertoCortina
changed the title
build-info.properties is generated in a different location causing errors with BuildProperties bean
build-info.properties is generated in a different path causing errors with BuildProperties bean
Mar 9, 2022
@wilkinsona Perhaps this is a separate issue, but with spring-boot 2.6.5 and gradle :bootJar, I'm still seeing the behavior where build-info.properties is placed in /META-INF rather than /BOOT-INF/classes/META-INF/.
This cause actuator/info endpoint to return nothing.
That would be a separate issue as this issue concerned a war deployed to a Servlet container.
The properties file is loaded from classpath:META-INF/build.properties. Both the root of the jar and BOOT-INF/classes are on the classpath so the file should be found from either location.
If you’d like us to investigate the problem that you are seeing, please open a new issue with a minimal sample that recreates it.
Versions used
Spring boot 2.6.4
Java 17
Gradle 7.4
Description of the bug
Starting from Spring boot 2.6.4 the build-info.properties file is generated in a different path causing the application to fail when it's deployed in a servlet container and you are using a BuildProperties bean.
Structure of the war using Spring boot 2.6.4
Structure of the war using Spring boot 2.6.3
How to reproduce the error
demo_2.6.4.zip
demo_2.6.3.zip
Download both projects (basically they are the same project just changing the Spring boot version) and run the following command in both of them. After it finishes you can compare the wars created under build/libs folder and check that the path of the file is different.
Also, to check the error produced when you run the war created by the project on a servlet container, you can find a docker-compose file that you can execute after generating the wars, and you will see the error at startup on the version using Spring boot 2.6.4
The text was updated successfully, but these errors were encountered: