Java Reference
In-Depth Information
means that the client doesn't have to handle this type of exception, and it doesn't know that the service
is implemented by an EJB component. The business interface for postage calculation is shown following:
public interface PostageService {
public double calculatePostage(String country, double weight);
Now, in FrontDeskImpl , you can define a setter method for the PostageService business interface
to let Spring inject the service implementation so that your FrontDeskImpl will no longer be EJB specific.
Later, if you reimplement the PostageService interface with another technology (SOAP, RMI, Hessian/
Burlap, Flash AMF, etc), you won't need to modify a single line of code.
public class FrontDeskImpl implements FrontDesk {
private PostageService postageService;
public void setPostageService(PostageService postageService) {
this.postageService = postageService;
public double calculatePostage(String country, double weight) {
return postageService.calculatePostage(country, weight);
Spring offers the proxy factory bean SimpleRemoteStatelessSessionProxyFactoryBean to create a
local proxy for a remote stateless session bean.
<beans xmlns=""
<bean id="postageService"
<property name="jndiEnvironment">
<prop key="java.naming.factory.initial">
<prop key="java.naming.provider.url">
<property name="jndiName" value="PostageServiceRemoteHome" />
<property name="businessInterface"
value="" />
Search WWH ::

Custom Search