Affects: spring-boot-starter-actuator:2.7.10
I had a test and depend on 'org.springframework.boot:2.7.10', 'spring-boot-starter-actuator:2.7.10', 'spring-boot-starter-amqp:2.7.10'. At the test, I haven't created any instance about RabbitMQ, just added the dependency that spring-boot-starter-amqp in the pom file. When the application gets the request of URI 'actuator/health', the instance of RabbitHealthIndicator doing doHealthCheck, then creating Rabbit connection. At some times, it isn't what we expected.
pom.xml
...
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.10</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
...
DemoApplication.java
@SpringBootApplication
public class DemoApplication
{
public static void main(String[] args) throws Exception
{
SpringApplication.run(DemoApplication.class, args);
}
}
application.yml
server:
port: 8083
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
This function be called on gets request '/actuator/health'
Comment From: snicoll
@tancen the spring framework issue tracker is the wrong place to report this, I've transferred the issue. The scenario you have described is to be expected. If you don't want to use Rabbit, don't include the starter or exclude the auto-configuration.