Questions tagged [spring]

The Spring Framework is an open-source framework for application development on the Java platform. At its core is rich support for component-based architectures, and it currently has over twenty highly integrated modules.

The Spring Framework is an open-source application framework for the Java platform.

Spring is a non-invasive, versatile, robust framework.

Spring framework complements the Java EE APIs but is not a replacement for Java EE. It reduces most boilerplate code, reducing the burden on developers.

Spring provides services and functionalities across the application domain, including a core Inversion of Control container, technology-agnostic data-access and MVC layers, extensive AOP support, task scheduling, and various integration patterns designed to make distributed system development more uncomplicated and more straightforward. While some Spring modules are simple wrappers and helpers over the Java EE specifications, most go far beyond the Java EE specification.

The latest Spring Framework Reference Documentation can be found here.

Spring version history:

Version    Date   
5.2.x    Dec, 2020
5.1.x    Sep, 2018 
5.0.x    Sep, 2017 
4.3.x    Jun, 2016 
4.2.x    Jul, 2015 
4.1.x    Sep, 2014 
4.0.x    Dec, 2013 
3.2.x    Dec, 2012 
3.1.x    Dec, 2011 
3.0.x    Dec, 2009 
2.5.x    Nov, 2007 
2.0.x    Jun, 2006 
1.2.x    Mar, 2005 
1.1.x    Jul, 2004 
1.0.x    Feb, 2004 

Frequently Asked Questions

People often ask about the following Spring topics:

Guides:

Video tutorial on Spring Framework

Examples:

Blog:

Related tags

More information:

Official Logo:


Spring logo

208702 questions
38
votes
5 answers

Can I use @Requestparam annotation for a Post request?

I have this controller method: @PostMapping( value = "/createleave", params = {"start","end","hours","username"}) public void createLeave(@RequestParam(value = "start") String start, @RequestParam(value =…
Maurice
  • 6,698
  • 9
  • 47
  • 104
38
votes
1 answer

What's the difference between @AutoConfigureWebMvc and @AutoConfigureMockMvc?

In which case should I use each one?
Ekaterina
  • 1,642
  • 3
  • 19
  • 36
38
votes
2 answers

How Spring Boot Application works internally?

I am working on Spring Boot. I have some doubt As i know spring boot has a main() and it calls static run() which is present in SpringApplication. But i want to know what is the flow of Spring boot application ? Can we run spring boot application…
Sangram Badi
  • 4,054
  • 9
  • 45
  • 78
38
votes
4 answers

Using `@ConfigurationProperties` annotation on `@Bean` Method

Could someone give a MWE of how to use the @ConfigurationProperties annotation directly on a @Bean method? I have seen countless examples of it being used on class definitions - but no examples yet for @Bean methods. To quote the…
tmj
  • 1,750
  • 2
  • 19
  • 34
38
votes
7 answers

Jackson date-format for OffsetDateTime in Spring Boot

I'm trying to output an OffsetDateTime from my Spring application, and have in my application.properties these properties: spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false spring.jackson.date-format=yyyy-MM-dd'T'HH:mm However when the…
Dave
  • 788
  • 1
  • 6
  • 11
38
votes
4 answers

Is there a difference between ? and * in cron expressions? Strange example

I have the following cron expression in my system: 0 0 0/1 1/1 * ? * and you know what? I have no idea what it means. The guy who has written it is on his holiday for the next 2 weeks so I have to find out on myself. The documentation can be found…
xenteros
  • 15,586
  • 12
  • 56
  • 91
38
votes
7 answers

How to run SQL scripts and get data on application startup?

I am developing a Spring Boot application. At the moment some of my configs are hard coded (e.g. Hystrix properties). So I would like to get these configs on my application start up time or just after that. Is it possible to do that using Spring…
Laurynas
  • 972
  • 2
  • 11
  • 24
38
votes
5 answers

UTF-8 encoding of application.properties attributes in Spring-Boot

In my application.properties I add some custom attributes. custom.mail.property.subject-message=This is a ä ö ü ß problem In this class I have the representation of the custom…
Patrick
  • 12,336
  • 15
  • 73
  • 115
38
votes
4 answers

Rollback on every checked exception, whenever I say @Transactional

Since the programmer is forced to catch all checked exception, I to throw checked exception in case of any problem. I would like to rollback on any of those expections. Writing rollbackFor=Exception.classon every @Transactional annotation is very…
pihentagy
  • 5,975
  • 9
  • 39
  • 58
38
votes
7 answers

How to selectively disable Eureka discovery client with Spring?

Is there a way to disable spring-boot eureka client registration based on the spring profile? Currently I use the following annotations: @Configuration @EnableAutoConfiguration @EnableDiscoveryClient @EnableConfigServer public class…
zinc wombat
  • 403
  • 1
  • 5
  • 6
38
votes
2 answers

Spring use one application.properties for production and another for debug

I have a Spring application and I would like to be able to switch between configurations depending if I'm debugging the server or if the server is running in production. (the difference in configurations being things like database…
Prichmp
  • 2,112
  • 4
  • 16
  • 17
38
votes
4 answers

Mongo tries to connect automatically to port 27017(localhost)

I am using Spring Rest and Mongo in Maven to make a web service that connects to a server. The problem is that I haven't written any code for Mongo and it is trying to connect to localhost throwing me a MongoSocketOpenException. The only code I've…
Haris V
  • 403
  • 1
  • 4
  • 5
38
votes
3 answers

How to handle HTTP OPTIONS requests in Spring Boot?

First off, I've read "How to handle HTTP OPTIONS with Spring MVC?" but the answers do not seem directly applicable to Spring Boot. It looks like I should do this: configure the dispatcherServlet by setting its dispatchOptionsRequest to true But…
Jonik
  • 80,077
  • 70
  • 264
  • 372
38
votes
12 answers

@RestController in other package doesn't work

I start with learning Spring and I create basic project which creates database, insert values and next print it in web browser. My problem is that when I have RestController in the same package like main class - its OK, but I want distribute it to…
CeZet
  • 1,473
  • 5
  • 22
  • 44
38
votes
4 answers

Order of Spring Bean Initialization

I have multiple context files. Requirement is: one particular Bean (which makes some configuration changes) to be initialized first among rest of beans. Is there a way to get this bean loaded first? One option is using depends-on` attribute. But…
Sandeep Jindal
  • 14,510
  • 18
  • 83
  • 121
1 2 3
99
100