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
2534
votes
29 answers

What's the difference between @Component, @Repository & @Service annotations in Spring?

Can @Component, @Repository and @Service annotations be used interchangeably in Spring or do they provide any particular functionality besides acting as a notation device? In other words, if I have a Service class and I change the annotation from…
Colin McCree
  • 25,405
  • 3
  • 15
  • 3
1074
votes
9 answers

What is difference between CrudRepository and JpaRepository interfaces in Spring Data JPA?

What is the difference between CrudRepository and JpaRepository interfaces in Spring Data JPA? When I see the examples on the web, I see them there used kind of interchangeably. What is the difference between them? Why would you want to use one…
kseeker
  • 10,783
  • 3
  • 15
  • 7
1046
votes
62 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
  • 60,022
  • 51
  • 208
  • 332
789
votes
11 answers

What is the difference between @Inject and @Autowired in Spring Framework? Which one to use under what condition?

I am going through some blogs on SpringSource and in one of the blogs, author is using @Inject and I suppose he can also use @Autowired. Here is the piece of code: @Inject private CustomerOrderService customerOrderService; I am not sure about the…
Rachel
  • 100,387
  • 116
  • 269
  • 365
761
votes
21 answers

Why is my Spring @Autowired field null?

Note: This is intended to be a canonical answer for a common problem. I have a Spring @Service class (MileageFeeCalculator) that has an @Autowired field (rateService), but the field is null when I try to use it. The logs show that both the…
chrylis -cautiouslyoptimistic-
  • 75,269
  • 21
  • 115
  • 152
721
votes
15 answers

Difference between and

I'm learning Spring 3 and I don't seem to grasp the functionality behind and . From what I've read they seem to handle different annotations (@Required, @Autowired etc vs @Component, @Repository,…
user938214097
  • 7,211
  • 3
  • 14
  • 3
709
votes
16 answers

Spring: @Component versus @Bean

I understand that @Component annotation was introduced in spring 2.5 in order to get rid of xml bean definition by using classpath scanning. @Bean was introduced in spring 3.0 and can be used with @Configuration in order to fully get rid of xml file…
user1396576
  • 7,101
  • 3
  • 14
  • 4
654
votes
17 answers

What exactly is Spring Framework for?

I hear a lot about Spring, people are saying all over the web that Spring is a good framework for web development. What exactly is Spring Framework for in a nutshell? Why should I used it over just plain Java.
Maksim
  • 16,635
  • 27
  • 94
  • 135
587
votes
19 answers

Where does the @Transactional annotation belong?

Should you place the @Transactional in the DAO classes and/or their methods or is it better to annotate the Service classes which are calling using the DAO objects? Or does it make sense to annotate both "layers"?
Thomas Einwaller
  • 8,873
  • 4
  • 40
  • 55
582
votes
11 answers

How does autowiring work in Spring?

I'm a little confused as to how the inversion of control (IoC) works in Spring. Say I have a service class called UserServiceImpl that implements UserService interface. How would this be @Autowired? And in my Controllers, how would I instantiate an…
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
544
votes
10 answers

Spring @Transactional - isolation, propagation

Can someone explain what isolation & propagation parameters are for in the @Transactional annotation via real-world example? Basically when and why I should choose to change their default values.
MatBanik
  • 26,356
  • 39
  • 116
  • 178
518
votes
16 answers

What in the world are Spring beans?

I am yet to find a high-level definition of Spring beans that I can understand. I see them referenced often in Grails documentation and books, but I think that understanding what they are would be beneficial. So what are Spring beans? How can they…
grantmcconnaughey
  • 10,130
  • 10
  • 37
  • 66
516
votes
24 answers

How can I log SQL statements in Spring Boot?

I want to log SQL statements to a file. I have the following properties in…
Oleg Pavliv
  • 20,462
  • 7
  • 59
  • 75
476
votes
14 answers

JsonMappingException: No suitable constructor found for type [simple type, class ]: can not instantiate from JSON object

I am getting the following error when trying to get a JSON request and process it: org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type [simple type, class com.myweb.ApplesDO]: can not instantiate from JSON object…
Lucky Murari
  • 12,672
  • 5
  • 22
  • 43
474
votes
32 answers

How to solve the “failed to lazily initialize a collection of role” Hibernate exception

I have this problem: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: mvc3.model.Topic.comments, no session or session was closed Here is the model: @Entity @Table(name = "T_TOPIC") public class Topic…
Eugene
  • 5,353
  • 6
  • 27
  • 37
1
2 3
99 100