Posts

Showing posts from August, 2017

Autowiring in Spring

Autowiring in Spring Autowiring feature of spring framework enables you to inject the object dependency implicitly. It internally uses setter or constructor injection. Autowiring can't be used to inject primitive and string values. It works with reference only. Advantage of Autowiring It requires the  less code  because we don't need to write the code to inject the dependency explicitly. Disadvantage of Autowiring No control of programmer. It can't be used for primitive and string values. Autowiring Modes There are many autowiring modes: No. Mode Description 1) no It is the default autowiring mode. It means no autowiring bydefault. 2) byName The byName mode injects the object dependency according to name of the bean. In such case, property name and bean name must be same. It internally calls setter method. 3) byType The byType mode injects the object dependency according

RMI with Spring

RMI with Spring Spring RMI lets you expose your services through the RMI infrastructure. Spring provides an easy way to run RMI application by the help of org.springframework.remoting.rmi. RmiProxyFactoryBean and org.springframework.remoting.rmi. RmiServiceExporter classes. Example: Let's see the simple steps to integration spring application with RMI: 1. Calculation.java 2. CalculationImpl.java 3. myBean.xml 4. client-beans.xml 5. Host.java 6. Client.java Calculation.java package com.smgc; public interface Calculation {             int cube( int number );             int square( int number );             int fact( int number ); } CalculationImpl.java package com.smgc; public class CalculationImpl implements Calculation {             @Override             public int cube( int number ) {                         // TODO Auto-generated method stub                         return number * number