What is Spring Framework & Overview of Spring Modules
What is Spring Framework
Spring Framework is the most ordinarily used framework in Java technologies to make applications.
Important features of the Spring Framework:
- Spring is an open source.
- Lightweight development with Java POJOs (Plain-Old-Java-Objects).
- Dependency injection to push loose coupling.
- Declarative programming with Aspect-Oriented-Programming (AOP).
- Minimize boilerplate Java code.
Open Source: In spring installation we will get its source code. This makes spring an open source for the people without taking a single penny.
POJO: The normal Java class which does not extend from the technology or framework API class and does not implement technology/framework API interfaces is termed the POJO class.
Dependency Injection: If the underlying server/container/framework/runtime (like JRE) assigns /injects values to resource/class/object dynamically at runtime then it is called dependency injection.
AOP: AOP is a new methodology of programming that complements OOP to separate secondary middleware services from primary business logic and allows to link them at runtime dynamically through some configurations. This gives advantages of reusing middleware service logics and flexibility of enabling or disabling middleware service logics on primary logics (like security, transaction, etc.)
Overview of Spring Modules:
The Spring Framework consists of features of the 20 modules. These modules are assembled into these are:
- Core Container
- Data Access/Integration
- Web, AOP (Aspect Oriented Programming)
The Core Container comprises the Core, Beans, Context, and Expression Language modules.
The Core and Beans modules are providing the fundamental parts of the framework, involving the IoC and Dependency Injection features. The BeanFactory is a worldly-wise implementation of the factory pattern. It gets rid of the need for programmatic singletons and allows you to decouple the configuration and specification of dependencies from your actual program logic. The Context module constructs on the solid base given by the Core and Beans modules: it is a means to access objects in a framework-style manner that is near to a JNDI registry. The Context module can take its features from the Beans module and adds support for internationalization (using, for example, resource bundles), event-propagation, resource-loading, and the transparent creation of contexts by, for example, a servlet container. The Context module also keeps up with Java EE features such as EJB, JMX, and basic remoting. The ApplicationContext interface is the centrepiece of the Context module.
The Expression Language module gives a powerful expression language for querying and manipulating an object graph at runtime. It is an addition of the unified expression language (unified EL) as specified in the JSP 2.1 specification. The language keeps up with the setting and getting property values, property assignment, method invocation, accessing the context of arrays, collections and indexers, logical and arithmetic operators, named variables, and fetching of objects by name from Spring's IoC container. It also keeps up list projection and selection as well as common list aggregations.
The Data Access/Integration layer contains the JDBC, ORM, OXM, JMS, and Transaction modules.
The JDBC module gives a JDBC-abstraction layer that removes the need to do tedious JDBC coding and parsing of database-vendor-specific error codes.
The ORM module gives integration layers for popular object-relational mapping APIs, including JPA, JDO, Hibernate, and iBatis. Using the ORM package you can use all of these O/R-mapping frameworks in the mix with all of the other features Spring offers, such as the simple declarative transaction management feature mentioned previously.
The OXM module gives an abstraction layer that supports Object/XML mapping implementations for JAXB, Castor, XMLBeans, JiBX, and XStream.
The Java Messaging Service (JMS) module includes features for producing and consuming messages.
The Transaction module holds up programmatic and declarative transaction management for classes that implement special interfaces and for all our POJOs (plain old Java objects) classes.
The Web layer comprises the Web, Web-Servlet, Web-Struts, and Web-Portlet modules.
Spring's Web module gives basic web-oriented integration features such as multipart file-upload functionality and the initialization of the IoC container using servlet listeners and a web-oriented application context. It also includes the web-related parts of the Spring's remoting support.
The Web-Servlet module includes Spring's model-view-controller (MVC) implementation for web applications. Spring's MVC framework helps a clean separation between domain model code and web forms and integrates with all the other features of the Spring Framework.
The Web-Struts module includes the support classes for integrating a classic Struts web tier within a Spring application. Note that this hold-up is now deprecated as of Spring 3.0. Think about migrating your application to Struts 2.0 and its Spring integration or a Spring MVC solution.
The Web-Portlet module comes up with the MVC implementation to be worked in a portlet environment and mirrors the functionality of the Web-Servlet module.
AOP and Instrumentation
Spring's AOP module gives an AOP Alliance-compliant aspect-oriented programming implementation allowing you to define, for example, method-interceptors and pointcuts to cleanly decouple code that implements functionality that should be separated. Using source-level information functionality, you can also incorporate behavioral information into your code, like that of .NET attributes.
The separate Aspects module gives integration with AspectJ.
The Instrumentation module gives class instrumentation support and classloader implementations to be used in certain application servers.
The Test module helps with the testing of Spring components with JUnit or TestNG. It gives consistent loading of Spring ApplicationContexts and caching of those contexts. It also gives mock objects that you can use to test your code in isolation.
This Spring Framework is very easy to use for us. Spring Boot is a technique that is commonly used by Java Developers in the industry for Spring Applications. Spring MVC is used for developing web applications. Spring Security is used for authorization, authentication, and permission features used in application development. We can develop applications in Kotlin, Java, and Groovy languages. Nowadays Spring Framework is a lot of demands in the Information Technology industry as a Java Developer. Because every Job posting looking for those candidates who are having knowledge and experience of this Spring Framework.
This topic is explained:
- What is Spring Framework?
- Important features of the Spring Framework
- Overview of Spring Modules?