Skip to content

Java Spring

  • Popular framework for building Java applications
  • Spring is a Object Factory

  • Simpler and lightweight alternative to J2EE (Java EE)

  • Java EE: Java Platform, Enterprise Edition - Currently version 8 (2017)

  • Multilayer architecture . Corporative applications
  • Earlier versions of EJB (Enterprise Java Beans v1 and v2) were extremely complex

  • Therefore the Spring Framework came along.

  • Book by Rod Johnson entitled Java Development with the Spring Framework
  • Spring arrived in 2004 (when java EE was in version 4)
  • Currently Spring version 5

Goals of Spring

  • Lightweight development with Java POJOs (Plain-Old-Java-Objects)
  • As a replacement to EJB
  • Dependency injection to promote loose coupling
  • Declarative programming with Aspect-Oriented-Programming (AOP)
  • Minimize boilerplate Java code

Spring Components

Spring Core Container

  • Factory for creating beans, manage bean dependencies

  • Beans

  • Core
  • SpEL
  • Context

Spring Infrastructure

  • AOP, Add functionalities to objects, logging, security, transactions, etc

  • AOP

  • Aspects
  • Instrumentations
  • Messaging

Data Access Layer

  1. JDBC
  2. ORM
  3. Transactions
  4. OXM, JMS

Web Layer

  1. Servlet
  2. WebSocket
  3. Web
  4. Portlet

Test Layer

  1. Unit
  2. Integration
  3. Mock

Spring Projects

  • Additional spring modules built on top of the core spring framework

  • Spring cloud, spring data

  • Spring batch, spring security
  • Spring for android, spring web flow
  • Spring web services, spring LDAP

Spring project

  • Directly from JAR files

  • https://repo.spring.io/release/org/springframework/spring/

  • Pick the spring-dist.zip
  • Copy all the .jar files inside the lib folder to the lib folder of your project
  • Add the lib folder to the classpath of the project
  • Project Configuration: Ctrl + Shift + Alt + S
  • Modules -> Dependencies -> + -> JARs or directories