Questions tagged [spring-boot]

Use the Spring Boot tag for questions related to spring boot framework and the features it brings to your Web application. This includes questions about configuration, embedding of the Web servers, setting up metrics, health checks, externalized configuration etc. It does not include questions about the Web server itself, Java code running in your application, or standard spring components. Tag these questions with its own tags to get the best response!

Spring Boot makes it very easy to create a Spring-powered application with a minimum amount of work. An application created with Spring Boot (you can quickly do it using Spring Initializr) can be:

  • Created without a single line of configuration,
  • Created without any requirement of an application server because Spring Boot provides an application server (Embed , or ).
  • Largely autoconfigured with some sensible defaults and opinionated starter POMs to simplify your configuration,
  • Provide production-ready features such as metrics, health checks, and externalized configuration.

Spring Boot consists of several (optional) modules

Spring Boot CLI

A command line interface, based on , for starting/stopping Spring Boot created applications.

Spring Boot Core

The base for other modules, but it also provides some functionality that can be used on its own, eg. using command line arguments and files as Spring Environment property sources and automatically binding environment properties to Spring bean properties (with validation).

Spring Boot Autoconfigure

Module to autoconfigure a wide range of Spring projects. It will detect the availability of certain frameworks ( , , , ). When detected it will try to automatically configure that framework with some sensible defaults, which in general can be overridden in an application.properties/.yml file.

Spring Boot Actuator

This project, when added, will enable certain enterprise features (Security, Metrics, Default Error pages) to your application. Like the auto configure module it uses autodetection to detect certain frameworks/features of your application.

Spring Boot Starters

Different quickstart projects to include as a dependency in your or build file. It will have the needed dependencies for that type of application. Currently, there are starter projects for a web project ( and based), , , , exist. Many more have been added over the years and the full list can be found here.

Spring Boot Tools

The and build tool, as well as the custom Spring Boot Loader (used in the single executable jar/war), is included in this project.

143171 questions
20
votes
6 answers

Launch browser automatically after spring-boot webapp is ready

How do I launch a browser automatically after starting the spring boot application.Is there any listener method callback to check if the webapp has been deployed and is ready to serve the requests,so that when the browser is loaded , the user sees…
Tito
  • 8,894
  • 12
  • 52
  • 86
20
votes
2 answers

Spring Boot with custom UserDetailsService

What is the correct way to add my custom implementation of UserDetailsService (which uses Spring Data JPA) to Spring Boot app? public class DatabaseUserDetailsService implements UserDetailsService { @Inject private UserAccountService…
igo
  • 6,359
  • 6
  • 42
  • 51
20
votes
1 answer

Can you specify multiple @Conditional annotations?

With Spring Boot, can one use multiple @Conditional annotations on one @Bean definition? If so, is there a predictable order that they are resolved? In other words, can I specify both @ConditionalOnResource and @ConditionalOnMissingBean on the same…
Justin Miller
  • 757
  • 2
  • 8
  • 19
20
votes
4 answers

Spring-Data-Rest Validator

I have been trying to add spring validators to a spring-data-rest project. I followed along and setup the "getting started" application via this link: http://spring.io/guides/gs/accessing-data-rest/ ...and now I am trying to add a custom…
20
votes
6 answers

Spring boot JAR as windows service

I am trying to wrap a spring boot "uber JAR" with procrun. Running the following works as expected: java -jar my.jar I need my spring boot jar to automatically start on windows boot. The nicest solution for this would be to run the jar as a…
roblovelock
  • 1,971
  • 2
  • 23
  • 41
20
votes
4 answers

How do you use a Tomcat JNDI JDBC datasource in Spring Boot

I have a Spring boot application and want to deploy as a WAR to Tomcat 7. As part of this I need to keep configuration out of the WAR, so that I can deploy the same war to my stage and production servers and have it pickup the mysql connection via…
Zac Tolley
  • 2,340
  • 4
  • 19
  • 22
19
votes
3 answers

wiremock issue when upgrading to Spring Boot 3

When upgrading my Spring Boot 2.5 to 3.0 , I am facing some issues with Wiremock, probably due to the move to jakarta namespace. Even upgrading to latest wiremock-jre8 , ie 2.35.0 (as of december 2022) doesn't seem to help. I get this error…
Vincent F
  • 6,523
  • 7
  • 37
  • 79
19
votes
7 answers

Spring Security in Spring Boot 3

I'm currently in the process of migrating our REST application from Spring Boot 2.7.5 to 3.0.0-RC2. I want everything to be secure apart from the Open API URL. In Spring Boot 2.7.5, we used to do this: @Named @EnableWebSecurity public class…
Thomas Oellrich
  • 1,019
  • 2
  • 8
  • 13
19
votes
9 answers

Swagger 2 Issue - Spring Boot

I was using a tutorial and everything was working fine until I started dealing with swagger 2 dependencies. I wonder now if there is a way to fix this. SwaggerConfig: package com.animes.apirest.config; import…
Nophi
  • 305
  • 1
  • 2
  • 5
19
votes
4 answers

Spring Cloud Gateway; Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway Issue

I got this below error when run the API-GATEWAY, I tried so many ways but I couldn't solve this issue. Description: Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway. Action: Please set…
Manoj Piyumal
  • 219
  • 1
  • 2
  • 10
19
votes
2 answers

Error when using @EnableWebFluxSecurity in springboot

Currently I´m trying to integrate JWT Authentication in an existing Spring Boot Webflux Project. As a template I used this medium article: https://medium.com/@ard333/authentication-and-authorization-using-jwt-on-spring-webflux-29b81f813e78. If I put…
FinishedHim
  • 345
  • 1
  • 3
  • 9
19
votes
3 answers

Is there a rule that forbids to name its entity class "User" when working with PostgreSQL and Spring Boot?

guys. I'm having a problem with a Spring boot 2.3.0 and PostgreSQL 12 project. I have an entity class I called User whose code is as follows: @Entity @NoArgsConstructor @Data @AllArgsConstructor @Builder public class User { @Id…
19
votes
3 answers

How to disable the Hypersistence banner when using hibernate-types-52 in Spring Boot?

I use the com.vladmihalcea:hibernate-types-52 dependency in my Spring Boot Project. And, I notice that on application boot, some large log messages were added: 2020-04-09 11:43:59.535 WARN 3465 --- [ main] Hypersistence Optimizer …
Simulant
  • 19,190
  • 8
  • 63
  • 98
19
votes
4 answers

Is there any special configuration to use SpringRunner with junit5?

My micro-service project based on spring-boot framework and all my unit test running with spring runner. @RunWith(SpringRunner.class) adding this annotations, imports the following library: import…
Ilan Miller
  • 323
  • 1
  • 3
  • 11
19
votes
5 answers

How to build the docker image using jib-maven-plugin, but not push by default?

I have a simple SpringBoot application and I want to build docker image using Jib Maven plugin. Following is my plugin configuration: com.google.cloud.tools jib-maven-plugin
K. Siva Prasad Reddy
  • 11,786
  • 12
  • 68
  • 95