DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Coding
  3. Frameworks
  4. My Favorite Features of Spring Boot

My Favorite Features of Spring Boot

What are your favorite features of Spring Boot? Check out this developer's thoughts on the best features of Spring Boot.

Swathi Prasad user avatar by
Swathi Prasad
·
Aug. 29, 18 · Opinion
Like (14)
Save
Tweet
Share
14.45K Views

Join the DZone community and get the full member experience.

Join For Free

Spring Boot is a lightweight framework that takes most of the work out of configuring Spring-based applications. It follows the “Opinionated Defaults Configuration” approach to reduce developer effort.

In this article, I will talk about some of my favorite features:

Endpoints

Spring Boot allows you to monitor and interact with your application. It includes several built-in endpoints, and you can add your own, as well. Auditing health and metrics gathering can be automatically applied to your application. For example, the health endpoint will be mapped to /health, which displays application health information.

We can enable the endpoints by simply adding the spring-boot-starter-actuator to the pom.

<dependency>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-starter-actuator</artifactId>

    <version>1.5.7.RELEASE</version>

</dependency>


Check out this complete list of endpoints provided by Spring Boot.

Auto-Configuration

Spring Boot auto-configuration represents a way to automatically configure a Spring application based on the dependencies that are present on the classpath. This can make development faster and easier.

For example, if h2 is on your classpath, then Spring Boot will auto-configure an in-memory database. You do not have to manually configure any database connection beans.

Spring Boot’s auto-configuration can be enabled by adding the @EnableAutoConfiguration annotation to your main Spring Boot application entry point class.

Git Commit ID

Git repository information can be injected into a Maven-built Spring Boot-based application. The exact Git commit ID will be exposed through the  /info actuator endpoint.

To do this, we will use the maven-git-commit-id-plugin.

<plugin>

    <groupId>pl.project13.maven</groupId>

    <artifactId>git-commit-id-plugin</artifactId>

    <version>2.2.3</version>

</plugin>


Profiles

When writing a library for usage, it’s usually the case that there are different environments on which it may run. With Spring’s profiles, it’s easy to define different configurations that only get active when a certain environment or use case needs them.

We can specify active profiles in the  application.properties then replace them using the command line switch. We can also have profile-specific properties that add to the active profiles rather than replace them.

Read more about profiles here.

Conclusion

There’s an entire community of people using Spring and contributing to it. If you want to know how to build Spring Boot-based projects, take a look at these spring-boot examples.

Spring Framework Spring Boot

Published at DZone with permission of Swathi Prasad, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Top 10 Best Practices for Web Application Testing
  • Best CI/CD Tools for DevOps: A Review of the Top 10
  • Unlocking the Power of Elasticsearch: A Comprehensive Guide to Complex Search Use Cases
  • Introduction to Spring Cloud Kubernetes

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: