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
102
votes
4 answers

Can a spring boot @RestController be enabled/disabled using properties?

Given a "standard" spring boot application with a @RestController, eg @RestController @RequestMapping(value = "foo", produces = "application/json;charset=UTF-8") public class MyController { @RequestMapping(value = "bar") public…
Bohemian
  • 412,405
  • 93
  • 575
  • 722
102
votes
33 answers

Spring Boot Program cannot find main class

I have a program which runs as a Spring boot App in eclipse. The program was running fine. Then i did the following: Right click on project -> Run As -> Maven Test . This was accidental. When i then tried to run the program as a spring boot app…
Christopher Jobling
  • 1,048
  • 2
  • 7
  • 10
101
votes
6 answers

Is there a compatibility matrix of Spring-boot and Spring-cloud?

I am wondering if a compatibility matrix exists between Springboot and Springcloud? I created a simple project on STS and am running into compatibility issues. org.springframework.boot
Manglu
  • 10,744
  • 12
  • 44
  • 57
101
votes
6 answers

Spring-Boot: How do I set JDBC pool properties like maximum number of connections?

Spring-Boot is a pretty awesome tool, but the documentation is a bit sparse when it comes to more advanced configuration. How can I set properties like the maximum size for my database connection pool? Spring-Boot supports tomcat-jdbc, HikariCP and…
JBCP
  • 13,109
  • 9
  • 73
  • 111
100
votes
5 answers

Securing Spring Boot API with API key and secret

I would like to secure the Spring Boot API so it is accessible only for the clients that has valid API key and secret. However, there is no authentication (standard login with username and password) inside the program as all data is anonymous. All…
Vitalii Oleksiv
  • 1,155
  • 2
  • 9
  • 11
99
votes
12 answers

How to test main class of Spring-boot application

I have a spring-boot application where my @SpringBootApplication starter class looks like a standard one. So I created many tests for all my functionalities and send the summary to sonarqube to see my coverage. For my starter class Sonarqube tells…
Patrick
  • 12,336
  • 15
  • 73
  • 115
99
votes
8 answers

Max limit of MultipartFile in Spring Boot

Is there a maximum file size that spring boot can handle in a MultipartFile upload process. I know that I can set the maxFileSize in the property like multipart.maxFileSize=1Mb. So, like that can I allow a huge file to upload, like 50MB. The…
Ravindu
  • 2,408
  • 8
  • 30
  • 46
99
votes
6 answers

Trying to use Spring Boot REST to Read JSON String from POST

Am using the latest version of Spring Boot to read in a sample JSON via Restful Web Service... Here's my pom.xml:
PacificNW_Lover
  • 4,746
  • 31
  • 90
  • 144
98
votes
8 answers

SpringBoot - BeanDefinitionOverrideException: Invalid bean definition

I am trying to setup DynamoDB locally with Spring Boot. Initially I got the setup working and was able to write/save to DynamoDB via a repository. From that point I added more classes to build my application. Now when I try to start my application,…
Vino
  • 2,111
  • 4
  • 22
  • 42
98
votes
18 answers

Spring Boot: How to specify the PasswordEncoder?

Currently I got the main class: package com.recweb.springboot; import org.springframework.boot.SpringApplication; import…
Aa Yy
  • 1,702
  • 5
  • 19
  • 34
98
votes
10 answers

Serving static web resources in Spring Boot & Spring Security application

I am trying to develop Spring Boot web application and securing it using Spring security java configuration. After placing my static web resources in 'src/main/resources/public' as advised here in Spring blog, I am able to get the static resources.…
Kumar Sambhav
  • 7,503
  • 15
  • 63
  • 86
97
votes
12 answers

Maven is not using Java 11: error message "Fatal error compiling: invalid target release: 11"

I am trying to compile my project with Java 11. When I try to run the application with Java 8 as the Java version in pom.xml, it works fine. But when I try to run it with Java 11, it throws an error. Fatal error compiling: invalid target release:…
Ayush Surana
  • 1,776
  • 1
  • 12
  • 16
96
votes
8 answers

Spring Security: Upgrading the deprecated WebSecurityConfigurerAdapter in Spring Boot 2.7.0

I am trying to update the WebSecurityConfigurerAdapter as it has been deprecated. The class is configured as follows: @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class WebSecurityConfig extends…
Ramon J.
  • 1,137
  • 1
  • 9
  • 7
95
votes
8 answers

Spring's @RequestParam with Enum

I have this enum : public enum SortEnum { asc, desc; } That I want to use as a parameter of a rest request : @RequestMapping(value = "/events", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public List
Antoine Martin
  • 1,903
  • 2
  • 16
  • 28
95
votes
17 answers

SpringBoot - making jar files - No auto configuration classes found in META-INF/spring.factories

Everything was working fine when starting my app using IntelliJ. But when I made a fat jar and executed it with java -jar myapp.jar I got this: 16:37:44.194 [main] ERROR org.springframework.boot.SpringApplication - Application startup…
Defozo
  • 2,946
  • 6
  • 32
  • 51