How is the EJB Implementation getting hooked up in here?
package com.apress.springrecipes.post;
import javax.ejb.Remote;
import javax.ejb.Stateless;
@Stateless
@Remote( { PostageService.class })
public class PostageServiceBean implements PostageService {
public double calculatePostage(String country, double weight) {
retu开发者_高级运维rn 1.0;
}
}
jndi-name="PostageServiceBeanRemote">
<jee:environment>
java.naming.factory.initial=org.apache.openejb.client.RemoteInitialContextFactory
java.naming.provider.url=ejbd://127.0.0.1:4201
</jee:environment>
</jee:jndi-lookup>
<bean id="frontDesk"
class="com.apress.springrecipes.post.FrontDeskImpl">
<property name="postageService" ref="postageService"/>
</bean>
</beans>
As far as I know, Spring only allows you to consume EJBs, which can be obtained from application server context. However, you cannot publish EJB beans with Spring: you need to use the facilities, provided by concrete application server for that (also depends on whether you want to use EJB 2 or EJB 3).
Have a look also at EJB3 with Spring.
精彩评论