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
1 answer

Detecting unused Spring beans

Given a Spring configuration that exclusively contains eager (non-lazy) singleton beans, i.e. the defaults, is it possible to have Spring throw an exception in the case where any of those beans is not injected anywhere? I'm essentially looking for a…
jaco0646
  • 15,303
  • 7
  • 59
  • 83
20
votes
1 answer

How can I mock db connection in Spring Boot for testing purpose?

Situation: I am using Spring Cloud with Spring Boot in a microservice, that microservice is loading a DB config information to configure a connection. I created a test to get the rest interfaces using Swagger for documentation. I want to disable…
Rys
  • 4,934
  • 8
  • 21
  • 37
20
votes
4 answers

spring jpa application.properties useSSL

I am trying to turn off ssl, to my local mysql database. But I cannot find the actual property in a spring application.properties file that would do this. my current file is: # =============================== # = DATA SOURCE #…
SJC
  • 2,767
  • 4
  • 20
  • 31
20
votes
6 answers

Spring Profiles, different Log4j2 configs

In my application.yml I got: logging: config: classpath:log4j2.debug.yml And some others in different profiles. When I start the Application I get the following: ERROR StatusLogger No log4j2 configuration file found. Using default…
Dennis Ich
  • 3,585
  • 6
  • 27
  • 44
20
votes
6 answers

How to configure a default @RestController URI prefix for all controllers?

I know you can set the server.contextPath in application.properties to change the root context. Also, I can add an additional context in the application config for Spring Boot like the following example (in Groovy) to add an "/api" to the URL…
pczeus
  • 7,709
  • 4
  • 36
  • 51
20
votes
3 answers

How to add context.xml file to embedded tomcat server

I'm trying to run my application in an embedded tomcat server using Spring-boot. I'm having my JNDI Resources and Environments configured in an XML file, placed under src/main/webapp/META-INF/context.xml in my application. When I deploy this…
SanjaySSN
  • 229
  • 1
  • 3
  • 6
20
votes
1 answer

Gradle dependency plugin in a multi module Spring Boot project

What does a correct Gradle configuration look like in a multi-module project that uses the Gradle plugins spring-boot-dependencies and spring-boot? I have the following project setup: parent | + build.gradle | + alpha | | | +…
matsev
  • 32,104
  • 16
  • 121
  • 156
20
votes
3 answers

resources in a Spring Boot application are missing from jar file when using Spring Boot Maven Plugin

I am using Spring-Boot v1.3.0.M5 with Maven v3.3.3. I used to be able to run my Spring Boot (boot) application from the console with this command. mvn clean package spring-boot:run However, I've had to revise my pom.xml to account for different…
Jane Wayne
  • 8,205
  • 17
  • 75
  • 120
20
votes
2 answers

Is Spring Boot with embedded Tomcat or Jetty Production grade

We're looking at converting some of our legacy JaveEE apps over to Spring Boot. We're getting a vendor in to perform this, but they claim that Spring boot with embedded Tomcat or Jetty is not production ready and instead recommend us to still…
arislan
  • 281
  • 1
  • 2
  • 7
20
votes
3 answers

Spring AOP change value of methods argument on around advice

Is it possible to change method argument value on basis of some check before executing using Spring AOP My method public String doSomething(final String someText, final boolean doTask) { // Some Content return "Some Text"; } Advice…
Ashish Aggarwal
  • 3,018
  • 2
  • 23
  • 46
20
votes
5 answers

debug spring-boot in docker

For some reason I have issues connecting remote debug to a spring-boot app running inside docker. I start the java app with: java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -jar app.jar For docker I expose these ports on…
Jarle Hansen
  • 1,993
  • 2
  • 16
  • 29
20
votes
1 answer

merge many application.properties files instead of replace on Spring Boot?

i am using Spring Booot MVC 1.2.2.RELEASE. I have my multi-module project which is structured like this: example-backend-development(parent) ---> example-backend-development-domain ---> example-backend-development-service I want to make both…
jscherman
  • 5,839
  • 14
  • 46
  • 88
20
votes
6 answers

Grails3 file upload maxFileSize limit

I am trying to update the file upload maxFileSize limit in Grails 3 and tried the configuration in src/main/resources/application.properties, application.groovy and application.yml, but it's still throwing the exception Class …
Naman Jain
  • 231
  • 1
  • 2
  • 8
20
votes
3 answers

Maven configuration with Spring Boot & multi modules - run application in Intellij

I'm currently working on a REST API with Spring Boot. I'm new to Maven and have just started coding with IDEA (don't know well this IDE yet), and I have a problem... Here is my project structure : parent pom.xml main…
klu00
  • 317
  • 1
  • 3
  • 15
20
votes
3 answers

How to configure dynamic properties while using spring boot?

I'm planning to use Spring Boot for my assignment. Its a typical server application with connection to database. I know I can use Spring Configuration to externalize my properties e.g. db connection details. But I also have other dynamic properties…
eton dolittle
  • 221
  • 1
  • 2
  • 5