I am learning Spring boot Actuator, notice that spring boot actuator not getting activated. I am following the documentation [spring docs][1], so adding the maven dependency as mentioned.
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
My POM.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>net.javapedia</groupId>
<artifactId>spring-scheduling</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring-scheduling</name>
<description>Spring scheduling example</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
My Spring application:
package net.javapedia.springscheduling;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
public class SpringSchedulingApplication {
public static void main(String[] args) {
SpringApplication.run(SpringSchedulingApplication.class, args);
}
}
application.properties
management.endpoints.enabled-by-default=true
Console output:
2020-03-28 22:05:31.184 INFO 63611 --- [ main] n.j.s.SpringSchedulingApplication : Starting SpringSchedulingApplication on localhost with PID 63611 (/Users/admin/IdeaProjects/spring-scheduling/target/classes started by admin in /Users/admin/IdeaProjects/spring-scheduling)
2020-03-28 22:05:31.189 INFO 63611 --- [ main] n.j.s.SpringSchedulingApplication : No active profile set, falling back to default profiles: default
2020-03-28 22:05:33.279 INFO 63611 --- [ main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'taskScheduler'
Running fixedRate Task, Thread name: scheduling-1
Running scheduled Task, iteration :1 Thread name: scheduling-1
2020-03-28 22:05:33.342 INFO 63611 --- [ main] n.j.s.SpringSchedulingApplication : Started SpringSchedulingApplication in 2.791 seconds (JVM running for 4.108)
I am trying to access the actuator health endpoint at http://localhost:8080/actuator/health but no luck.
[1]: http://%20https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-enabling