@Override
  protected Serializable extractSerializableFromMessage(ObjectMessage message) throws JMSException {
    Serializable bean = super.extractSerializableFromMessage(message);
    System.out.println("-------------KKOTA----------" + bean.getClass());
    beanConfigurerSupport.configureBean(bean);

    return bean;
  }
Exemple #2
0
  public synchronized void configureBean(String bn, Object beanInstance, boolean checkWildcards) {

    if (null == appContexts) {
      return;
    }

    if (null == bn) {
      bn = getBeanName(beanInstance);
    }

    if (null == bn) {
      return;
    }
    // configure bean with * pattern style.
    if (checkWildcards) {
      configureWithWildCard(bn, beanInstance);
    }

    final String beanName = bn;
    setBeanWiringInfoResolver(
        new BeanWiringInfoResolver() {
          @Override
          public BeanWiringInfo resolveWiringInfo(Object instance) {
            if (!"".equals(beanName)) {
              return new BeanWiringInfo(beanName);
            }
            return null;
          }
        });

    for (ApplicationContext appContext : appContexts) {
      if (appContext.containsBean(bn)) {
        this.setBeanFactory(appContext.getAutowireCapableBeanFactory());
      }
    }

    try {
      // this will prevent a call into the AbstractBeanFactory.markBeanAsCreated(...)
      // which saves ALL the names into a HashSet.  For URL based configuration,
      // this can leak memory
      if (beanFactory instanceof AbstractBeanFactory) {
        ((AbstractBeanFactory) beanFactory).getMergedBeanDefinition(bn);
      }
      super.configureBean(beanInstance);
      if (LOG.isTraceEnabled()) {
        LOG.trace("Successfully performed injection,used beanName:{}", beanName);
      }
    } catch (NoSuchBeanDefinitionException ex) {
      // users often wonder why the settings in their configuration files seem
      // to have no effect - the most common cause is that they have been using
      // incorrect bean ids
      if (LOG.isDebugEnabled()) {
        LOG.debug("No matching bean {}", beanName);
      }
    }
  }