SPRING
- WHAT IS SPRING
- ADVANTAGES
- APPLICATIONS
A basic overview of the Spring framework is shown with examples. Rod Johnson invented it in 2003.
The Spring framework makes it easy to construct JavaEE applications.Spring Framework A free-floating spring is the shape. It appears to be a framework of frameworks since it supports several other frameworks, such as Struts, Hibernate, Tapestry, EJB, JSF, and more. Another way to look at it as a framework that we may use to tackle various technological problems.Numerous modules for IOC, AOP, DAO, Context, ORM, WEB MVC, and many more topics are included in the Spring framework. We shall learn about these courses on the next page. Let's first review dependency injection and IOC.Why to use spring?The Spring framework is an example of an open-source Java platform. In June 2003, Rod Johnsonfirst publicly released it under the Apache 2.0 license. Spring is a featherweight in terms of viscosityand volume. The typical Spring Framework installation takes up around 2 MB of space. The Java EEplatform may be used to construct web apps with the Spring Framework, but any Java program canbe created by leveraging its basic features. The POJO-based programming paradigm provided by theSpring framework encourages excellent programming practices and facilitates J2EE development.
Inversion of control (IOC) and dependency injection By removing dependencies, these design principles aim to simplify programming. They facilitate codemaintenance and testing. We shall understand this with the aid of the following code.
Here, the place and the employee are closely related to one another. In a scenario involving reversecontrol, we arrive at this.As a result, the IOC only applies the code rigorously. We won't have to deal with the code
when we apply our logic in a new setting.It is the IOC container's responsibility to install the dependency in the Spring framework.We contribute metadata to the IOC repository in two formats: annotations and XML files.Dependency injection benefits include:makes code easily testableloosely linked for easier maintenance.
Advantages of spring framework Spring Framework has many advantages. They are as follows:1) Predefined templatesSpring provides templates for several technologies, including JDBC, Hibernate, JPA, andothers. Having said that, a ton of code is unnecessary. hiding these technologiesunderlying mechanisms.Take the Jdbc Template for example. There is no need to write code to handle exceptions,create a connection, create an expression, bind an event, close a connection, etc. Toexecute the query, all we have to do is write code. Therefore, it saves a ton of JDBCcode.
2) Loose coupling Dependency injection makes Spring apps loosely connected.3) Easy to testDependency injection makes testing applications easier. Spring apps don't need serversto run, in contrast to Struts and Enterprise JavaBeans (EJB) applications.
4) LightweightThe lightweight framework's low weight is a result of the POJO implementation. TheSpring Framework does not require the implementation of interfaces or classinheritance. That explains why its name is non-intrusive.
5) Fast developmentSpringThe framework's dependency injection and multi-framework support make it easy todevelop JavaEE applications.
6) Powerful abstractionStrong abstraction is offered for JavaEE standards, including JMS, JDBC, JPA, and JTA.7) Declarative supportFor caching, validation, events, and formatting, it offers declarative support.Applications of spring POJO-basedWith POJO applications and Spring, developers may create enterprise-levelapplications. You may forego using an EJB container as an application server ifyou solely use POJOs. An alternative is to use a reliable server container likeTomcat or any other commercial program.
ModularSpring is installed modularly. Even with many packages and classes, you only need tocare about what you need and ignore the others.
Integrate with existing frameworksRather than building from the ground up, Spring makes extensive use of existingtechnologies. These include several JEE, Quartz, JDK timers, loggingframeworks, object relationship management (ORM) frameworks, and othervisualization tools.
TestabilityBecause environment-dependent code is placed in this framework, testing the application written in Spring is negligible. Additionally, using JavaBean-style POJOs makes it easy to use dependency injection to inject test data.Web MVCThe well-designed Spring Web Framework is a good choice as an alternative to too-complex web frameworks like Struts. This MVC framework is based on the web.alternative web frameworks.
Central Exception HandlingWith Spring's simple API, exceptions thrown by technologies such as JDBC, Hibernate,or JDO may be simply converted into consistent unchecked exceptions.
LightweightOne common feature of IoC containers is their lightweight nature, especially whencompared to EJB containers. This makes it simple to design and distributeprograms with low memory and CPU requirements.


No comments:
Post a Comment