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.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论