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
227
votes
22 answers

Add context path to Spring Boot application

I am trying to set a Spring Boot applications context root programmatically. The reason for the context root is we want the app to be accessed from localhost:port/{app_name} and have all the controller paths append to it. Here is the application…
CorreyS
  • 2,433
  • 3
  • 15
  • 16
226
votes
10 answers

Spring MVC - How to get all request params in a map in Spring controller?

Sample URL: ../search/?attr1=value1&attr2=value2&attr4=value4 I do not know the names of attr1, att2, and attr4. I would like to be able to do something like that (or similar, don't care, just as long as I have access to the Map of request param…
MDb
  • 2,261
  • 2
  • 14
  • 3
225
votes
7 answers

Difference between the annotations @GetMapping and @RequestMapping(method = RequestMethod.GET)

What's the difference between @GetMapping and @RequestMapping(method = RequestMethod.GET)? I've seen in some Spring Reactive examples, that @GetMapping was used instead of @RequestMapping
nowszy94
  • 3,151
  • 4
  • 18
  • 33
224
votes
8 answers

What is Dispatcher Servlet in Spring?

In this image (which I got from here), HTTP request sends something to Dispatcher Servlet. My Question is what does Dispatcher Servlet do? Is it something like getting the information thrown from the web page and throwing it to the controller?
Kevin
  • 23,174
  • 26
  • 81
  • 111
222
votes
9 answers

Spring @Autowired usage

What are the pros and cons of using @Autowired in a class that will be wired up by Spring? Just to clarify, I'm talking specifically about the @Autowired annotation, not auto-wiring in XML. I probably just don't understand it, but to me it almost…
Andy White
  • 86,444
  • 48
  • 176
  • 211
222
votes
3 answers

What is the difference between Spring's GA, RC and M2 releases?

Spring's 3.0 version is now GA release, before that they have launched 3.0 RC1, RC2 version Also, there was Spring 3.0 M2 version. What's the difference between GA, RC, M versions?
Rakesh Juyal
  • 35,919
  • 68
  • 173
  • 214
219
votes
8 answers

Map enum in JPA with fixed values?

I'm looking for the different ways to map an enum using JPA. I especially want to set the integer value of each enum entry and to save only the integer value. @Entity @Table(name = "AUTHORITY_") public class Authority implements Serializable { …
Kartoch
  • 7,610
  • 9
  • 40
  • 68
219
votes
4 answers

When use ResponseEntity and @RestController for Spring RESTful applications

I am working with Spring Framework 4.0.7, together with MVC and Rest I can work in peace with: @Controller ResponseEntity For example: @Controller @RequestMapping("/person") @Profile("responseentity") public class…
Manuel Jordan
  • 15,253
  • 21
  • 95
  • 158
216
votes
26 answers

Spring Boot not serving static content

I can't get my Spring-boot project to serve static content. I've placed a folder named static under src/main/resources. Inside it I have a folder named images. When I package the app and run it, it can't find the images I have put on that…
Vinicius Carvalho
  • 3,994
  • 4
  • 23
  • 29
213
votes
3 answers

How Spring Security Filter Chain works

I realize that Spring security build on chain of filters, which will intercept the request, detect (absence of) authentication, redirect to authentication entry point or pass the request to authorization service, and eventually let the request…
Tuomas Toivonen
  • 21,690
  • 47
  • 129
  • 225
212
votes
17 answers

What is the proper way to re-attach detached objects in Hibernate?

I have a situation in which I need to re-attach detached objects to a hibernate session, although an object of the same identity MAY already exist in the session, which will cause errors. Right now, I can do one of two…
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
212
votes
13 answers

How to define a List bean in Spring?

I'm using Spring to define stages in my application. It's configured that the necessary class (here called Configurator) is injected with the stages. Now I need the List of Stages in another class, named LoginBean. The Configurator doesn't offer…
guerda
  • 23,388
  • 27
  • 97
  • 146
211
votes
10 answers

With Spring can I make an optional path variable?

With Spring 3.0, can I have an optional path variable? For example @RequestMapping(value = "/json/{type}", method = RequestMethod.GET) public @ResponseBody TestBean testAjax( HttpServletRequest req, @PathVariable String type, …
Shamik
  • 6,938
  • 11
  • 55
  • 72
209
votes
11 answers

How do I tell Spring Boot which main class to use for the executable jar?

Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.0.1.RELEASE:repackage failed: Unable to find a single main class from the following candidates My project has more than one class with a main method. How do I tell the…
Thilo
  • 257,207
  • 101
  • 511
  • 656
207
votes
4 answers

REST API - DTOs or not?

I am currently creating a REST-API for a project and have been reading article upon article about best practices. Many seem to be against DTOs and simply just expose the domain model, while others seem to think DTOs (or User Models or whatever you…
benbjo
  • 2,382
  • 3
  • 18
  • 21