Java Reference
In-Depth Information
<bean id="weatherService"
<property name="serviceUrl"
value=" rmi://localhost:1099/WeatherService" />
<property name="serviceInterface"
value="" />
There are two properties you must configure for an RmiProxyFactoryBean instance. The service
URL property specifies the host and port of the RMI registry, as well as the service name. The service
interface allows this factory bean to create a proxy for the remote service. The proxy will transfer the
invocation requests to the remote service transparently. You can test this service with the following
Client main class:
import org.springframework.context.ApplicationContext;
public class Client {
public static void main(String[] args) {
ApplicationContext context =
new ClassPathXmlApplicationContext("client.xml");
WeatherServiceClient client =
(WeatherServiceClient) context.getBean("client");
TemperatureInfo temperature = client.getTodayTemperature("Houston");
System.out.println("Min temperature : " + temperature.getMin());
System.out.println("Max temperature : " + temperature.getMax());
System.out.println("Average temperature : " + temperature.getAverage());
5-2. Creating EJB 2.x Components with Spring
In EJB 2.x, each EJB component requires a remote/local interface, a remote/local home interface, and a
bean implementation class, in which you must implement all EJB life cycle callback methods even if you
don't need them.
Spring's remoting support can't completely remove the burden of all these requirements, but it does
provide powerful support for building EJB2.x components with Spring. The Spring support classes
facilitate building session beans— stateful session beans (SFSBs) and stateless session beans (SLSBs) —and
message-driven beans (MDBs) with Spring. Classic entity beans have no direct support in Spring,
presumably because they map more usefully to something like Hibernate or JDO. These classes provide
empty implementation for all EJB life cycle callback methods.
Search WWH ::

Custom Search