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
7 answers

Sub-Resources in spring REST

I'm trying to build messanger app. I've to call CommentResource from MessageResource. I want separate MessageResources and CommentResources. I'm doing something like this : MessageResource.java @RestController @RequestMapping("/messages") public…
prranay
  • 1,789
  • 5
  • 23
  • 33
20
votes
1 answer

spring-boot testing - Could multiple test share a single context?

I created multiple spring-boot testing class, (with spring-boot 1.4.0). FirstActionTest.java: @RunWith(SpringRunner.class) @WebMvcTest(FirstAction.class) @TestPropertySource("classpath:test-application.properties") public class FirstActionTest { …
Eric
  • 22,183
  • 20
  • 145
  • 196
20
votes
1 answer

Redirecting websocket communication from client to a server to another websocket server

I already have a SimpleBrokerWebsocket implementation. Now I am migrating towards microservices based architecture and trying to create messaging as a separate microservice. To avoid breaking existing client deployments and to gradually move…
Vivek
  • 326
  • 1
  • 3
  • 15
20
votes
4 answers

How to set UTF-8 character encoding in Spring boot?

I use spring-boot in my project, and I run this jar file which is built by spring-boot as a service on Centos. When I run this service: service myApp start I always get the below error messages: 2016-08-26 09:11:02.002 ERROR 31900 --- [ …
Coding minion
  • 527
  • 2
  • 4
  • 12
20
votes
5 answers

Authentication error when accessing mongodb through Spring Boot app

I have some trouble connecting to a remote mongodb from a java spring boot application. The MongoDB server has no firewall set up, and I can connect to mongo remotely from another machine. I have a database with collections and a user set up. When I…
IndyStef
  • 747
  • 1
  • 6
  • 15
20
votes
4 answers

ElasticBeanstalk Java, spring active profile

I am trying to start a spring boot .jar via AWS ElasticBeanstalk. Everything works fine, with the profile "default". Does anybody know how to set the active profile(spring.profiles.active) for a java ElasticBeanstalk app(not tomcat). I always get…
20
votes
2 answers

Run a void setup method in Spring Context @Configuration

I wish to perform a couple of setup methods within my Spring Context. I currently have the following code but it doesn't work as I am saying they are beans and have no return type. @Configuration @Component public class MyServerContext { ... …
ptimson
  • 5,533
  • 8
  • 35
  • 53
20
votes
4 answers

SpringBoot: Can't Autowire Class from Other Jar Library

I am developing a SpringBoot application (e.g. MyApp) with dependency to two data projects with different implementation: data-jdbc.jar built using the spring-boot-starter-jdbc which exposes JDBCDataService class that will be used by my…
Jown
  • 453
  • 1
  • 3
  • 17
20
votes
8 answers

Spring Boot API with Multiple Controllers?

I am starting to learn Spring Boot. I am struggling to find an example with multiple RestControllers, which indicates to me that I may be doing something wrong. I am trying a very simple example: The goal is to make calls like the…
user1529412
  • 3,616
  • 7
  • 26
  • 42
20
votes
4 answers

Spring Boot Security + Thymeleaf : IProcessorDialect class missing

I'm trying to integrate the Thymeleaf security dialect (such as sec:authorize tag) into a Spring Boot + Spring Security application that is working properly. After some research I found that the solution to activate that is to: Add the dependency in…
20
votes
3 answers

spring yml file for specific environment

I have 3 yml files namely application-default.yml -> default properties, should be available in all profiles application-dev.yml -> properties only for dev profile application-prod.yml -> properties only for prod profile When I start my boot…
Amar Dev
  • 1,360
  • 2
  • 18
  • 38
20
votes
3 answers

Spring Boot doesn't load application.yml config

I have a simple main app: @Configuration @EnableAutoConfiguration @ComponentScan(basePackages = "dreamteam.eho") @Import({EhoConfig.class}) public class MainApp implements CommandLineRunner, ApplicationContextAware { With…
yazabara
  • 1,253
  • 4
  • 21
  • 39
20
votes
6 answers

SpringBoot + ActiveMQ - How to set trusted packages?

I'm creating two springboot server & client applications communicating using JMS, and everything is working fine with the release 5.12.1 for activemq, but as soon as I update to the 5.12.3 version, I'm getting the following error…
AntoineB
  • 4,535
  • 5
  • 28
  • 61
20
votes
1 answer

I18n in Spring boot + Thymeleaf

I'm trying to make a multilanguage application using Spring boot and Thymeleaf. I made few properties files to save the different messages but I'm only able to display it in my browser language (I tried extensions to change browser locale but they…
No One
  • 674
  • 2
  • 10
  • 25
20
votes
2 answers

Spring JPA: How to upsert without losing data

Is there any way for insert a new record if doesn't exist and update the record if exist without losing old data? This is my service layer method: public void saveSample(Sample sample) { Sample samplePersistent = sample; if (sample.getId()…
Arif Acar
  • 1,461
  • 2
  • 19
  • 33