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
115
votes
6 answers

JSON parse error: Can not construct instance of java.time.LocalDate: no String-argument constructor/factory method to deserialize from String value

I am new to Spring Data REST project and I am trying to create my first RESTful service. The task is simple, but I am stuck. I want to perform CRUD operations on a user data stored in an embedded database using RESTful API. But I cannot figure out…
zavanton
  • 1,424
  • 2
  • 9
  • 14
115
votes
13 answers

Load different application.yml in SpringBoot Test

I'm using a Spring Boot app which runs my src/main/resources/config/application.yml file. When I run my test case by : @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes =…
Exia
  • 2,381
  • 4
  • 17
  • 24
115
votes
10 answers

Breakpoint at "throw new SilentExitException()" in Eclipse + Spring Boot

Every time I run my Spring Boot project on debug mode in Eclipse IDE (Spring Tool Suite), the thread stops at throw new SilentExitException(); line even without a breakpoint. Is there some solution to avoid this…
115
votes
8 answers

How to disable 'X-Frame-Options' response header in Spring Security?

I have CKeditor on my JSP and whenever I upload something, the following error pops out: Refused to display 'http://localhost:8080/xxx/xxx/upload-image?CKEditor=text&CKEditorFuncNum=1&langCode=ru' in a frame because it set 'X-Frame-Options' to…
Bravo
  • 1,944
  • 4
  • 29
  • 53
115
votes
35 answers

Spring Boot - Error creating bean with name 'dataSource' defined in class path resource

I have Spring Boot web application. It's centered around RESTful approach. All configuration seems in place but for some reason MainController fails to handle request. It results in 404 error. How to fix it? @Controller public class MainController…
J.Olufsen
  • 13,415
  • 44
  • 120
  • 185
114
votes
12 answers

Spring Security 5 : There is no PasswordEncoder mapped for the id "null"

I am migrating from Spring Boot 1.4.9 to Spring Boot 2.0 and also to Spring Security 5 and I am trying to do authenticate via OAuth 2. But I am getting this error: java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id…
Jimmy
  • 1,719
  • 3
  • 21
  • 33
114
votes
10 answers

Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

I am using Spring Data JPA and Spring Boot. The layout of the application is this main +-- java +-- com/lapots/game/monolith +-- repository/relational +--RelationalPlayerRepository.java +-- web …
lapots
  • 12,553
  • 32
  • 121
  • 242
113
votes
10 answers

After Spring Boot 2.0 migration: jdbcUrl is required with driverClassName

SOLVED: My solution: I delete dataSource() method from DatabaseConfig.java. Then, the application was started successfully :) I've just updated my Spring Boot project from 1.5.x to 2.0.0. Before the update, this application works properly but after…
Batuhan Kök
  • 1,312
  • 2
  • 10
  • 11
112
votes
20 answers

CORS with spring-boot and angularjs not working

I am trying to call REST endpoints on one application (spring-boot application) from another (angularjs). The applications are running on the following hosts and ports. REST application, using spring boot, http://localhost:8080 HTML application,…
Jane Wayne
  • 8,205
  • 17
  • 75
  • 120
111
votes
14 answers

What is the best way to return different types of ResponseEntity in Spring-Boot (Error Handling for REST with Spring)

I have written simple REST application in Spring Boot (Spring Framework). It returns ResponseEntity as Success response in the controller level. But I want to return a completely different Error response ResponseEntity, if there is…
Saveendra Ekanayake
  • 3,153
  • 6
  • 34
  • 44
111
votes
24 answers

IntelliJ 15, SpringBoot devtools livereload not working

Having issues with the new LiveReload feature with Spring Boot devtools 1.3. It doesn't reload on class changes. I've seen it demo'd with IntelliJ @ Devoxx 2015. Is there some IDE setting I need to have enabled? I'm running via the IDE and not…
Timm-ah
  • 1,276
  • 2
  • 10
  • 9
110
votes
7 answers

How to Solve 403 Error in Spring Boot Post Request

I am newbie in spring boot rest services. I have developed some rest api in spring boot using maven project. I have successfully developed Get and Post Api. My GET Method working properly in postman and mobile. when i am trying to hit post method…
Harshal Deshmukh
  • 1,787
  • 3
  • 14
  • 25
110
votes
24 answers

"Unable to find main class" with Maven on spring-boot project in Eclipse

I am pretty desperate since I no longer can compile my Maven projects. I have one logical project split into 7 maven modules which so far compiled fine, but today I introduced a feature, whereby I accidentally generated a circular maven dependency.…
Alex
  • 1,387
  • 2
  • 9
  • 14
110
votes
25 answers

Caused by: org.flywaydb.core.api.FlywayException: Validate failed. Migration Checksum mismatch for migration 2

I tried to find the solution for the below problem, but none of them worked for me. I am developing Angular + Spring Boot application using MySQL + flyway. Please guide whats going wrong here. org.springframework.beans.factory.BeanCreationException:…
user5707585
110
votes
12 answers

How to re-create database before each test in Spring?

My Spring-Boot-Mvc-Web application has the following database configuration in application.properties…
Dims
  • 47,675
  • 117
  • 331
  • 600