Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot AutoConfigure versus Spring Boot Actuator

Tags:

spring-boot

I am in reference to the Spring Boot documentation about the Autoconfigure and the Actuator modules:

AutoConfigure:

Spring Boot AutoConfiguration attempts to automatically configure your Spring application based on the dependencies that it declares. For example, If HSQLDB is on your classpath, and you have not manually configured any database connection beans, then we will auto-configure an in-memory database.

Actuator:

The aim of this project is minimum fuss for getting applications up and running in production, and in other environments. There is a strong emphasis on implementing RESTful web services but many features are more generic than that.

From this official documentation, it is difficult to determine what the difference is between those two modules...

Can anyone please provide an official and canonical answer explaining the difference?

like image 865
balteo Avatar asked Nov 30 '22 19:11

balteo


2 Answers

Did you see this in the main README:

Spring Boot Actuator provides additional auto-configuration to decorate your application with features that make it instantly deployable and supportable in production. For instance if you are writing a JSON web service then it will provide a server, security, logging, externalized configuration, management endpoints, an audit abstraction, and more. If you want to switch off the built in features, or extend or replace them, it makes that really easy as well.

The Actuator is a plugin or extension to Spring Boot Autoconfigure with more features that are mostly non-functional, and focused on production readiness.

like image 191
Dave Syer Avatar answered Dec 04 '22 03:12

Dave Syer


AutoConfiguration and Actuator are different.

AutoConfiguration is explained on Spring.io: http://projects.spring.io/spring-boot/docs/spring-boot-autoconfigure/README.html

Spring Boot AutoConfiguration attempts to automatically configure your Spring application based on the dependencies that it declares. For example, If HSQLDB is on your classpath, and you have not manually configured any database connection beans, then we will auto-configure an in-memory database.

Add an @EnableAutoConfiguration annotation to your primary @Configration class to enable auto-configuration:

import org.springframework.boot.autoconfigure.*;
import org.springframework.context.annotation.*;

@Configuration
@EnableAutoConfiguration
public class MyConfiguration {
}

@EnableAutoConfiguration tells Spring Boot to start adding beans based on classpath settings, other beans, and various property settings.

There is a good example of autoconfiguration and actuator on Spring.io through a Guide entited: "Building an Application with Spring Boot"

Here is a high-level explanation of Actuator from that guide:

If you are building a web site for your business, you probably need to add some management services. Spring Boot provides several out of the box with its actuator module, such as health, audits, beans, and more.

You will see a new set of RESTful end points added to the application. These are management services provided by Spring Boot.

They include: errors, environment, health, beans, info, metrics, trace, dump, and shutdown.

A better explanation of Actuator is here: http://projects.spring.io/spring-boot/docs/spring-boot-actuator/README.html

As explained in this document, in order to use Actuator you need to have it on your classpath (e.g. included as a dependency in a Mavan pom.xml file).

like image 20
Erik Markhauser Avatar answered Dec 04 '22 01:12

Erik Markhauser