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
39
votes
10 answers

Spring @JsonIgnore not working

How can I get @JsonIgnore to work I have a class. And even if I put the annotation there it has no effect on the output. I am using Jackson. public class QuestionBlock implements ComparableByID{ int ID; String title; String…
czadam
  • 1,827
  • 1
  • 18
  • 31
39
votes
2 answers

Spring vs Java EE 7

Now I am reading "Begining Java EE 7". And I was wondered that Java EE 7 is a good stack of technologies, it includes CDI, bean validation, JSF for web tier and other specifications. So I got a question: Why should I study Spring framework if Java…
Korobko Alex
  • 816
  • 1
  • 7
  • 10
39
votes
4 answers

How to set response header in spring mvc

I have a method in which i want to set response header cache-control and pragma :- public String addUser(@Valid User user, BindingResult bindingResult) { if(bindingResult.hasErrors()) { bindingResult.getFieldError(); …
M Kumar
  • 566
  • 1
  • 4
  • 10
39
votes
5 answers

Best practice to select data using Spring JdbcTemplate

I want to know what is the best practice to select records from a table. I mentioned two methods below from that I want to know which one is best practice to select the data from a table using Spring JdbcTemplate. First example try { String sql…
Annamalai Thangaraj
  • 522
  • 1
  • 5
  • 10
39
votes
2 answers

Difference webcontent and webapp

I've two Spring MVC projects in Eclipse, but the web content is in different positions. In one app it's located under: /WebContent In the other app under: /src/main/webapp Why that? What's the difference? Is there any way I can see how each…
user1883212
  • 7,539
  • 11
  • 46
  • 82
39
votes
4 answers

using Spring JdbcTemplate - injecting datasource vs jdbcTemplate

As per Spring documentation, the steps to use Spring JdbcTemplate is as follows:
SGB
  • 2,118
  • 6
  • 28
  • 35
39
votes
4 answers

Must Spring component classes be thread-safe

If you use Spring, must your component classes (@Controller, @Service, @Repository) be thread safe? Or does Spring use them in a thread-safe manner so you don't have to worry about thread safety? That is, if I have a @RequestMapping method in my…
Raedwald
  • 46,613
  • 43
  • 151
  • 237
39
votes
4 answers

Why not to use Spring's OpenEntityManagerInViewFilter

While a lot of posts have been written on the subject of Spring's OpenSession/EntityManagerInViewFilter, I couldn't find any that mentions its flaws. From what I understand, and assuming a typical layered web application architecture using a…
user186427
39
votes
1 answer

alternative to GrantedAuthorityImpl() class

I want an alternative to GrantedAuthorityImpl() class. I want this in spring security implementation. GrantedAuthorityImpl() class is deprecated. Hence I want an alternative solution to it. My code : public Collection
Oomph Fortuity
  • 5,710
  • 10
  • 44
  • 89
39
votes
4 answers

Jackson automatic formatting of Joda DateTime to ISO 8601 format

According to http://wiki.fasterxml.com/JacksonFAQDateHandling, “DateTime can be automatically serialized/deserialized similar to how java.util.Date is handled.” However, I am not able to accomplish this automatic functionality. There are…
Jeff M
  • 1,055
  • 1
  • 10
  • 22
39
votes
2 answers

No property found for type error when try to create custom repository with Spring Data JPA

I have a Media entity that has some basic fields for files uploaded by the user. For saving the bytes of the files uploaded, I want to create a custom repository that holds that functionality. Following the steps in the Spring documentation, I've…
dnc253
  • 39,967
  • 41
  • 141
  • 157
39
votes
3 answers

Spring Data JPA - Why are changes to a returned Entity automatically persisted?

I present the question with an example. Assert that we have a Repository such as the below: public interface ExampleObjectRepository extends CrudRepository { } By extending the JpaRepository interface, the ExampleObject…
8bitjunkie
  • 12,793
  • 9
  • 57
  • 70
39
votes
7 answers

Dealing with command line arguments and Spring

When I'm writing a Spring command line application which parses command line arguments, how do I pass them to Spring? Would I want to have my main() structured so that it first parses the command line args and then inits Spring? Even so, how would…
lowellk
  • 2,049
  • 4
  • 21
  • 26
39
votes
6 answers

Forward HttpServletRequest to a different server

I got a HttpServletRequest request in my Spring Servlet which I would like to forward AS-IS (i.e. GET or POST content) to a different server. What would be the best way to do it using Spring Framework? Do I need to grab all the information and build…
user1144031
  • 627
  • 2
  • 6
  • 16
39
votes
2 answers

How to enable with java-based annotations

I am trying to set up Spring AOP without any XML. I'd like to enable in a class which is annotated with @Configuration. This is the way it would be defined in an XML-file:
user1374907
  • 391
  • 1
  • 3
  • 3