Content deleted Content added
(5 intermediate revisions by 3 users not shown) | |||
Line 25:
! Version
! Date
|-
| 0.9 || 2003
|-
| 1.0 || March 24, 2004
|-
| 2.0 || 2006
|-
| 3.0 || 2009
|-
| 4.0 || 2013
|-
| 5.0 || 2017
|-
| 6.0 || November 22, 2022
|-
| 6.1 || November 16, 2023
|-
| 6.2 || November 14, 2024
|-
|}
Line 88 ⟶ 87:
Objects created by the container are called managed objects or [[JavaBeans|beans]].{{sfn | Deinum | Long | Mak | Rubio | 2014 | loc=§2-16 Use Property Editors in Spring|pp=112-116}} The container can be configured by loading [[XML]] (Extensible Markup Language) files{{sfn | Deinum | Long | Mak | Rubio | 2014 | loc=§2-1 Manage and Configure POJOs with the Spring IoC Container | pp=48-52}}{{sfn | Johnson | Hoeller | 2004}}{{rp|pp=151–152}} or detecting specific [[Java annotation]]s on configuration classes. These data sources contain the bean definitions that provide the information required to create the beans.
The {{code|@Configuration}} is a Spring-specific annotation that marks a class as the configuration class. The configuration class provides the beans to the Spring {{code|ApplicationContext}}.{{sfn|Walls|2019|loc=§1.1 Getting started with Spring - What is Spring|pp=4-6}} Each of the methods in the Spring configuration class is configured with the {{code|@Bean}} annotation. The {{code|ApplicationContext}} interface will then return the objects configured with the {{code|@Bean}} annotation as beans. The advantage of
==== Types of Inversion of Control ====
Line 101 ⟶ 100:
====Autowiring====
The Spring framework has a feature known as autowiring, which uses the
There are several annotations that can be used for autowiring POJOs, including the Spring-specific annotation {{code|@Autowire}} (as well as several other Spring-specific annotations that help resolve autowire ambiguity such as the {{code|@Qualifier}} or {{code|@Primary}} annotations),{{sfn | Deinum | Long | Mak | Rubio | 2014 | loc=§3-3 Use POJO References and Auto-Wiring to Interact with other POJOs |pp=145-151}}{{sfn | Cosmina | Harrop | Schaefer | Ho | 2017 | loc=§3 Introducing IoC and DI in Spring - Autowiring Your Beans | pp=112-120 }} and the standard Java annotations {{code|@Resource}} and {{code|@Inject}}.{{sfn | Deinum | Long | Mak | Rubio | 2014 | loc=§3-4 Auto-wire POJOs the @Resource and @Inject annotation | pp=151-154}}
The {{code|@Qualifier}} annotation can be used on a class that defines a bean to inform Spring to prioritize the bean creation when autowiring it by '''name'''.{{sfn | Cosmina | Harrop | Schaefer | Ho | 2017 | loc=§3 Introducing IoC and DI in Spring - Autowiring Your Beans | pp=112-120 }}
The {{code|@Primary}} annotation can be used on a class that defines a bean to inform Spring to prioritize the bean creation when autowiring it by '''type'''.{{sfn | Cosmina | Harrop | Schaefer | Ho | 2017 | loc=§3 Introducing IoC and DI in Spring - Autowiring Your Beans | pp=112-120 }}
The {{code|@Resource}} annotation is an annotation that conforms to [[JSR 250]], or Common Annotations for the Java Platform
The {{code|@Inject}} annotation is an annotation that conforms to JSR 300, or Standard Annotations for injection ===Aspect-oriented programming framework===
Line 121 ⟶ 122:
Spring AOP has been designed to work with cross-cutting concerns inside the Spring Framework.{{sfn | Johnson | Hoeller | 2004}}{{rp | p=473}} Any object which is created and configured by the container can be enriched using Spring AOP.
The Spring Framework uses Spring AOP internally for transaction management, security, remote access, and [[Java Management Extensions|JMX]].<ref>{{
Since version 2.0 of the framework, Spring provides two approaches to the AOP configuration:
|