Pages

Tuesday 8 April 2014

Difference between Construct and Setter Injection



Constructor Injection 

Setter Injection 

1. Injecting bean properties through argumented constructor.

1.Injecting bean properties through setter method.
2. It will first inject the bean dependencies then create the instance of current bean.

2. It will first create the bean instance and then inject the bean dependencies.

3. Chance of forming Cyclic Dependency

3. No chance of Cyclic Dependency.


4. In case of Auto-wiring it can done with "construtor autowiring process ".

4. It can be possible with two autowiring concept ,
    a. byName                b. byType

5. No chance of getting UnsatisfiedDependencyExeption.

5. UnsatisfiedDependencyException in case of byType autowiring. 

6. In case of Explicit Wiring,
<constructor-arg/> tag is use to define this injection. 
6. <property/> tag s used to define this injection

7. In Cyclic Dependency , only one bean will be injecting by ignoring cyclic dependency. 
7. Doesn't form Cyclic Dependency, so both the bean will be injected successfully.

Saturday 5 April 2014

Difference between Explicit and Auto Wiring in the Spring




Explicit Wiring 

Auto Wiring

1. Explicit Wiring means hard-coding the dependencies in the XML.

1. Not hard-coding in the XML file rather Container to detect and inject Dependencies.
2. Mainly it can be done in two ways
    a. Constructor   b. Setter injection 
2. It can be done in four ways 
a. byName     b. byType
c. constructor  d. autodetect
3. It requires writing more content in the XML which ultimately makes XML little complex.  
3. It doesn't require much writing rather need just any of the four value to the autowire attribute. 

Thursday 3 April 2014

Difference Between SOAP and REST WebServices




SOAP WebServices 

REST WebServices

1. SOAP stands for Simple Object Access Protocol.

1.REST stands for REpresentational  State Transfer
2.  It is the concept which uses SOAP libraries both at client and Server side. 
2. It is the concept uses HTTP Specification for request and response.
3. In this, client sends a SOAP document(XML document) as a request to the WebServices.
3. In this,  client sends request as a  HTTP request to the WebServices.
4. WebService sends a SOAP document as a response to the client. 
4. WebService sends a XML document as a response to the client.
5. It implements SOAP library for communication. 
5. It does not uses any library for communication, use HTTP as a message resource.  
6. It is little complex to implement as compared to REST.
6. It is easier to implement. 
7. SOAP document is WSDL (Web
Services Definition language ) which is formally a XML document. 
7.It uses HTTP GET as a request to
read the WebService and POST as to CREATE a new resource from the requested data.
8.  " @WebService " annotation is
used at the SEI (Service Endpoint Interface)  and SIB ( Service Implementation Bean )
8. " @WebServiceProvider " is used in the service class and implements Provider interface.