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
19
votes
5 answers

Creating custom ErrorWebExceptionHandler fails

I am trying to create my own ErrorWebExceptionHandler in Spring Boot 2 by extending the default one but my application fails to start with the following message: Caused by: java.lang.IllegalArgumentException: Property 'messageWriters' is required at…
Milosz Tylenda
  • 342
  • 2
  • 10
19
votes
8 answers

Hibernate saves/retrieves date minus day if application uses another timezone than MySQL

I have an application started on tomcat on MACHINE_A with timezone GMT+3. I use remote MySQL server started on MACHINE_B with timezone UTC. We use spring-data-jpa for persistence. As an example of the problem, I will show the repository: public…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
19
votes
2 answers

Mockito cannot create Spy of @Autowired Spring-Data Repository

I am trying to overlay my whole test environment with Mockito.spy functionality so whenever I want i can stub a method but all other calls go to default functionality. This worked very well with the Service layer but I have problems with the…
a-kraschitzer
  • 191
  • 1
  • 1
  • 4
19
votes
3 answers

Kafka Streams with Spring Boot

I want to work with Kafka Streams real time processing in my spring boot project. So I need Kafka Streams configuration or I want to use KStreams or KTable, but I could not find example on the internet. I did producer and consumer now I want to…
19
votes
7 answers

Spring upload file size limit error

I am using Spring Boot and I can send images that are smaller than 1MB, but when I make a post request with a large image larger than 1MB I get this error: Maximum upload size exceeded; nested exception is…
Ryan Fasching
  • 449
  • 2
  • 11
  • 21
19
votes
3 answers

How to deny access to all URLs by default?

When defining new spring boot REST resources, I tend to forget to also create a spring security configuration for their url patterns. How can I, by default, deny access to all URLs, and only allow access to explicitly configured URL patterns? (I am…
slartidan
  • 20,403
  • 15
  • 83
  • 131
19
votes
4 answers

Best way define important credentials in spring boot

When using Spring Boot application we use different application.properties files according to different environments. We put important credentials like: database configurations, server IPs, admin username/password and so on. I am worrying about…
Abhishek saini
  • 507
  • 1
  • 8
  • 29
19
votes
4 answers

How to read excel file using spring boot

I am making a spring boot application which will take the excel file and store its content and store it in database. I have tried many ways..but not successful. Does anyone have an idea about how to do this. I don't know how to make the controller…
Manish Bansal
  • 819
  • 2
  • 8
  • 19
19
votes
3 answers

sending udp broadcast from a docker container

I'm having a few docker containers (Using docker-compose and a single network - network-sol) One of the containers is a Spring Boot application that sends UDP broadcast to the local network. 255.255.255.255 fails because It's the local broadcast…
royB
  • 12,779
  • 15
  • 58
  • 80
19
votes
4 answers

How to use Spring WebClient to make multiple calls simultaneously?

I want to execute 3 calls simultaneously and process the results once they're all done. I know this can be achieved using AsyncRestTemplate as it is mentioned here How to use AsyncRestTemplate to make multiple calls simultaneously? However,…
ddzz
  • 259
  • 1
  • 3
  • 10
19
votes
5 answers

Global CORS configuration breaks when migrating to Spring Boot 2.0.x

Why is my 'Access-Control-Allow-Credentials' no longer being sent in response to preflight calls (OPTIONS) under Spring Boot 2.0.x (2.0.1.RELEASE in my case)? Here is my Global CORS Configuration that works fine under Spring Boot…
Geyser14
  • 1,385
  • 3
  • 14
  • 32
19
votes
4 answers

LazyInitializationException: could not initialize proxy - no Session

I use spring-data-jpa with spring-boot(v2.0.0.RELEASE), I just wrote a CRUD demo on MySQL, but an exception occurs during runtime, source code as follows: Source code User.java @Entity public class User implements Serializable { private…
Shuai Junlan
  • 535
  • 1
  • 6
  • 22
19
votes
1 answer

Kotlin + Gradle Unresolved Reference

As per this question I'm trying to setup the following project structure project/ settings.gradle projectB/ # some common code (using spring-boot) build.gradle com/ foo/ bar/... projectA/ # an android…
Dan
  • 12,857
  • 7
  • 40
  • 57
19
votes
7 answers

com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect in Spring Boot

I am developing code from http://www.javainuse.com/spring/spring-cloud-netflix-zuul-tutorial, no customization yet. I keep getting the error mentioned below. So, to avoid this error I added the following in application.properties…
Jeff Cook
  • 7,956
  • 36
  • 115
  • 186
19
votes
3 answers

@LocalServerPort missing from Spring Boot 2.0.0.RELEASE

I upgraded my app from spring boot 1.5.9.RELEASE to 2.0.0.RELEASE, and I can no longer import org.springframework.boot.context.embedded.LocalServerPort. I was using this to inject the port the server is running on during a test: public class…
Kevin
  • 1,080
  • 3
  • 15
  • 41