zoukankan      html  css  js  c++  java
  • EJB 根据beanName引用EJB

    @EJB (beanName = "CAProxySubMessageHandlerImpl")
    private CAProxyMessageHandler subscriptionHandler; package karl.common.ejb;

    import karl.event.NotificationMessage;

    public interface CAProxyMessageHandler {

        public void processMessage(NotificationMessage msg) throws Exception;

    package karl.message;

    import javax.ejb.Local;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;

    import karl.event.NotificationMessage;

    @Stateless
    @Local(CAProxyMessageHandler.class)
    @Remote(CAProxyMessageHandler.class)
    public class CAProxyMessageHandlerImpl implements CAProxyMessageHandler {

        @Override
        public void processMessage(NotificationMessage msg) throws Exception {
            //TODO
        } 

    package karl.message;

    import javax.ejb.Local;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;

    import karl.event.NotificationMessage;

    @Stateless
    @Local(CAProxyMessageHandler.class)
    @Remote(CAProxyMessageHandler.class)
    public class CAProxySubMessageHandlerImpl implements CAProxyMessageHandler {

        @Override
        public void processMessage(NotificationMessage msg) throws Exception {
            //TODO
        } 

    在其他的EJB里面可以这么引用这个两个EJB

    @EJB (beanName = "CAProxySubMessageHandlerImpl")

    private CAProxyMessageHandler submessageHandler; 

    @EJB (beanName = "CAProxyMessageHandlerImpl")

    private CAProxyMessageHandler messageHandler; 

      
  • 相关阅读:
    strust1.x的jar包
    DispatchAction,LookupDispatchAction,MappingDispatchAction
    Android ADT插件配置
    怎样搭建Android开发平台
    转发和重定向的区别
    时间js
    strtus spring hibernate ssh面试内容总结
    航行
    教你怎么避免重启你的应用程式 web ReLoadConfig ReLoadInterval contextConfigLocation
    WebSpher 6.1 安装与应用
  • 原文地址:https://www.cnblogs.com/zhonghan/p/2231829.html
Copyright © 2011-2022 走看看