Overview of the Spring Framework - BunksAllowed

BunksAllowed is an effort to facilitate Self Learning process through the provision of quality tutorials.

Community

Overview of the Spring Framework

Share This

Rod Johnson's book Expert One-on-One: J2EE Design and Development (Wrox, 2002) served as the inspiration for the Spring Framework. The Spring Framework has had significant growth in its core functionality, related projects, and community support during the past ten years. It's beneficial to quickly review the key features that have been included in each milestone release of Spring, up to Spring Framework 5.0, in light of the recent major release of the framework.

The idea of inversion of control forms the foundation of the Spring Framework. An approach called IoC externalizes the process of establishing and maintaining component dependencies. Examine an instance where class Foo requires a class Bar instance to carry out some sort of processing. Typically, Foo uses the new operator to create an instance of Bar or gets one from a factory class. By using the IoC methodology, some other process provides Foo with an instance of Bar (or a subclass) at runtime. Martin Fowler called IoC as the far more descriptive dependency injection (DI) as a result of this behavior, the injection of dependencies at runtime.

The foundation of Spring's DI solution is JavaBeans and interfaces, two fundamental Java ideas. You can define dependent settings in your applications using a variety of methods (such as XML files, Java configuration classes, code annotations, or the new Groovy bean definition method) when you use Spring as the DI provider. A standardized technique for generating Java resources with multiple configuration options, such constructors and setter methods, is offered by JavaBeans (POJOs).

DI and interfaces are two technologies that work well together. It is evident that creating an application with interfaces through design and coding results in a versatile application; yet, the intricacy of connecting an interface-designed application adds to the coding burden for developers. You can practically eliminate the amount of code required in your application to employ an interface-based design by utilizing DI. Similarly, you may make the most of DI by utilizing interfaces, as your beans can use any implementation of an interface to fulfill their dependency. By using interfaces, Spring is also able to leverage the Proxy pattern and JDK dynamic proxies to deliver strong ideas like AOP for cross-cutting issues.

With DI, Spring functions more like a container than a framework, giving your application classes instances with all the dependencies they require while being far less invasive in the process. The only requirement to use Spring for DI is to name your classes according to the JavaBeans conventions; there are no unique classes to inherit or proprietary naming schemes to adhere to. If anything, the only modification you need to do to an application using DI is to make additional JavaBeans properties visible, which enables more dependencies to be injected during runtime.

Happy Exploring!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.