group-icon
Java Developers
Group for Java developers and programmers. Ask questions and get answers related to Java programming
252 Members
Join this group to post and comment.
Soubhik Maji
Soubhik Maji
Computer Science
04 Feb 2019

Spring framework overview

We can use Spring framework. It  provides more flexibility as spring MVC is entirely based on interfaces unlike structs or hibernate so we can easily make changes in our implementation without affecting client side .


Framework/APi's  makes  it easier ..makes our life easier



It increases the efficiency and overall development time 


Spring MVC  


Dependency injection 


Spring controllers are configured using IOC 


Live in real world 


Spring core |


Inversion of control- you don't need to create objects on your own the spring container  will create the object after reading the web.xml file ...developer will specify in that file 


Bean or model or pojo(plain old java object)...only with methods to read and write ..not business logic..


Objects are created using the spring core container and you just obtain the reference to the container 


Objects get created only when you request for them using getbean...bean is DATA


------------------------------------------------------


Spring framework core  layer 5 simple steps -


1.Bean class 

2.XML file

3.Demo class

4.load jar file

5.Run


------------------------------------------------------

Spring container ??--


1.Beanfactory is a spring conatiner 


2.Application context is also a spring conatiner ..it is basically

 implementation of bean factory 



You can either use bean factory or applicationcontext to inject bean



Diff... Application Context will create the object even when you don't request ... 

   Beanfactory will create the object only when you request 


Objects will be created by spring core container 


Application context is build on top of bean factory ...it will create even  when. You don't  ask 


Beanfactory will create only when you ask by messaging ..getbean ....

Message oriented programming


------------------------------------------------------


IOC conatiner features 


1.construction of the objects 


2.managing the entire life cycle of your object   (just like servlet conatiner)


3.wiring them together ..dependencies ..that you can link up ..


4.Configuration...is just the key value pair that you can link up ...so u just need to configure your object in the XML file


Dependency can be justified using constructor or setter 

     

    Spring way ...XML | Ioc



Dependency injection- loose coupling

------------------------------------------------------


Objects here will get destroyed only when we close the container if we take init and destroy in our hands ...


Else some manger..(spring container) will take care 


Dependency injection can be done by two ways either by constructor or by setter 





Shruthi Pillai
Shruthi Pillai
Information Technology
1mo ago

Spring framework makes the easy development of JavaEE application. It provides support to various frameworks such as Struts, Hibernate, Tapestry, EJB, JSF etc. The Spring framework comprises several modules such as IOC, AOP, DAO, Context, ORM, WEB MVC etc. 

Spring framework provides templates for JDBC, Hibernate, JPA etc. technologies. So there is no need to write too much code.

It provides declarative support for caching, validation, transactions and formatting.


DHIRAJ LOTLIKAR
DHIRAJ LOTLIKAR
Information Technology
1mo ago

The framework is a model when you will get all inbuild stuffs and it will give give you different design patterns. We various design patterns such as Factory, abstract factory, behavioural design pattern etc. For web technology we have struts framework.

Spring is one of the best framework I java now. It is all in one framework. We have different modules in spring. We have Spring core, Spring MVC which provide framework, we have spring ORM  which connect hibernate and spring together.

If you go spring.io website they will provide you the list of modules available. We need to only focus on spring framework. Also there a new module known spring boot and it will make software development process easy.

After complting core java you can go towards spring core. By this you can build application.