Version | Release Date |
---|---|
6.0.x | 2022-11-22 |
5.0.x | 2017-10-24 |
4.3.x | 2016-06-10 |
4.2.x | 2015-07-31 |
4.1.x | 2014-09-14 |
4.0.x | 2013-12-12 |
3.2.x | 2012-12-13 |
3.1.x | 2011-12-13 |
3.0.x | 2009-12-17 |
2.5.x | 2007-12-25 |
2.0.x | 2006-10-04 |
1.2.x | 2005-05-13 |
1.1.x | 2004-09-05 |
1.0.x | 2003-03-24 |
Investigate Spring Boot:
Project Setup:
Create a POJO Class (e.g., Employee.java):
package com.test;
public class Employee {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void displayName() {
System.out.println(name);
}
}
Create an XML Configuration File (e.g., beans.xml):
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="<http://www.springframework.org/schema/beans>"
xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>"
xsi:schemaLocation="<http://www.springframework.org/schema/beans>
<http://www.springframework.org/schema/beans/spring-beans-4.3.xsd>">
<bean id="employee" class="com.test.Employee">
<property name="name" value="test spring"></property>
</bean>
</beans>
Create Main Class (e.g., Customer.java):
package com.test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Customer {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
Employee obj = (Employee) context.getBean("employee");
obj.displayName();
}
}
Include Dependencies:
Spring is a comprehensive framework that provides a set of classes, abstracting away boilerplate logic in Java EE development. It simplifies the coding process by handling repetitive tasks, allowing developers to focus on business logic. Here's why you should choose Spring:
In a simple JDBC application, developers are traditionally responsible for tasks like loading the driver class, creating connections and statements, handling exceptions, creating queries, executing queries, and closing connections. Spring abstracts away this boilerplate code, enabling developers to write cleaner, more concise code.
While Struts focuses on web aspects and is invasive in nature, Spring offers several advantages:
Spring is considered an alternative to Struts but is not a replacement for J2EE API. Spring's internal classes may use J2EE API classes, emphasizing its compatibility rather than replacement. The vast Spring framework is modular, with important modules such as:
Each module is independent, except for the Spring Core, allowing developers to choose and use specific modules based on project requirements.