Questions tagged [spring-boot]

Spring Boot is a framework that allows to easily create Spring-powered, production-grade applications and services with the absolute minimum fuss. It takes an opinionated view of the Spring platform designed to work for new and experienced users of Spring.

Spring Boot makes it very easy to create a Spring-powered application with a minimum amount of work. An application created with Spring Boot 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.

104965 questions
897
votes
57 answers

How to configure port for a Spring Boot application

How do I configure the TCP/IP port listened on by a Spring Boot application, so it does not use the default port of 8080.
Paul Verest
  • 51,779
  • 39
  • 174
  • 288
410
votes
16 answers

How to log SQL statements in Spring Boot?

I want to log SQL statements in a file. I have the following properties in…
Oleg Pavliv
  • 18,466
  • 7
  • 54
  • 68
386
votes
25 answers

How to access a value defined in the application.properties file in Spring Boot

I want to access values provided in application.properties, e.g.: logging.level.org.springframework.web: DEBUG logging.level.org.hibernate: ERROR logging.file=${HOME}/application.log userBucket.path=${HOME}/bucket I want to access userBucket.path…
Qasim
  • 6,662
  • 7
  • 31
  • 47
343
votes
17 answers

Spring Boot: How can I set the logging level with application.properties?

This is very simple question, but I cannot find information. (Maybe my knowledge about Java frameworks is severely lacking) How can I set the logging level with application.properties? And logging file location, etc?
zeodtr
  • 8,591
  • 13
  • 37
  • 57
319
votes
4 answers

What is the purpose of mvnw and mvnw.cmd files?

When I created a Spring Boot application I could see mvnw and mvnw.cmd files in the root of the project. What is the purpose of these two files?
shaunthomas999
  • 4,284
  • 2
  • 22
  • 28
295
votes
8 answers

What is the difference between putting a property on application.yml or bootstrap.yml in spring boot?

What is the difference between putting a property on application.yml or bootstrap.yml in spring boot? In logging.config case, the application works different.
Rys
  • 4,075
  • 6
  • 19
  • 35
263
votes
17 answers

Running code after Spring Boot starts

I want to run code after my spring-boot app starts to monitor a directory for changes. I have tried running a new thread but the @Autowired services have not been set at that point. I have been able to find ApplicationPreparedEvent, which fires…
stewsters
  • 2,795
  • 2
  • 12
  • 7
257
votes
11 answers

Difference between Spring MVC and Spring Boot

I have just started learning Spring. In my next step, I would like to develop bigger web applications. Now I am wondering if I should start with Spring Boot or Spring MVC. I have already read some stuff, but it is confusing because both look…
Gero
  • 10,601
  • 18
  • 58
  • 101
253
votes
33 answers

org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

I am trying run a spring-boot application which uses hibernate via spring-jpa, but i am getting this error: Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set at…
Kleber Mota
  • 7,249
  • 26
  • 80
  • 165
250
votes
23 answers

How can I add a filter class in Spring Boot?

Is there any annotation for a Filter class (for web applications) in Spring Boot? Perhaps @Filter? I want to add a custom filter in my project. The Spring Boot Reference Guide mentioned about FilterRegistrationBean, but I am not sure how to use it.
janetsmith
  • 7,972
  • 11
  • 48
  • 72
247
votes
10 answers

Spring Boot Configure and Use Two DataSources

How can I configure and use two data sources? For example here is what I have for the first data source: application.properties #first db spring.datasource.url = [url] spring.datasource.username = [username] spring.datasource.password =…
juventus
  • 2,482
  • 2
  • 9
  • 7
226
votes
19 answers

Spring Boot - Loading Initial Data

I'm wondering what the best way to load initial database data before the application starts? What I'm looking for is something that will fill my H2 database with data. For example, I have a domain model "User" I can access users by going to /users…
Lithicas
  • 3,003
  • 4
  • 17
  • 27
224
votes
10 answers

Override default Spring-Boot application.properties settings in Junit Test

I have a Spring-Boot application where the default properties are set in an application.properties file in the classpath (src/main/resources/application.properties). I would like to override some default settings in my JUnit test with properties…
FrVaBe
  • 44,054
  • 15
  • 110
  • 143
221
votes
33 answers

Spring Boot - Cannot determine embedded database driver class for database type NONE

This is the error that is thrown when trying to run my web app: [INFO] WARNING: Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name…
quarks
  • 29,080
  • 65
  • 239
  • 450
212
votes
15 answers

Unable to find a @SpringBootConfiguration when doing a JpaTest

I'm new to frameworks (just passed the class) and this is my first time using Spring Boot. I'm trying to run a simple Junit test to see if my CrudRepositories are indeed working. The error I keep getting is: Unable to find a…
Thomas Billet
  • 2,141
  • 2
  • 11
  • 12
1
2 3
99 100