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; 

      
  • 相关阅读:
    Hiveserver2高可用实现
    centos7 mysql数据库安装和配置
    ubuntu18.04 安装hadoop 2.7.3+hive 2.3.4
    imx6 RGB LCD
    imx6 KEY_ROW4 power output high fail
    ar1020 驱动移植 无效
    24C02 Twr
    undefined reference to `switch_dev_unregister'
    cannot open /proc/bus/usb/devices, No such file or directory
    imx6dl i2c4 support
  • 原文地址:https://www.cnblogs.com/zhonghan/p/2231829.html
Copyright © 2011-2022 走看看