Announcement Announcement Module
Collapse
No announcement yet.
inner beans don't receive ApplicationEvent objects? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • inner beans don't receive ApplicationEvent objects?

    I have two beans both implementing ApplicationListener configured as in the following example

    Code:
    	<bean id="testbean" class="TestBean">
    		<property name="innerBean">
    			<bean class="InnerBean"/>
    		</property> 
    	</bean>
    Code:
    public class TestBean implements ApplicationListener &#123;
    	private InnerBean innerBean;
    	
    	public void onApplicationEvent&#40;ApplicationEvent event&#41; &#123;
    		System.out.println&#40;"TestBean received " + event&#41;;
    	&#125;
    
    	public void setInnerBean&#40;InnerBean innerBean&#41; &#123;
    		this.innerBean = innerBean;
    	&#125;
    
    &#125;
    Code:
    public class InnerBean implements ApplicationListener &#123;
    
    	public void onApplicationEvent&#40;ApplicationEvent event&#41; &#123;
    		System.out.println&#40;"InnerBean received " + event&#41;;
    	&#125;
    &#125;
    The outer bean receives ApplicationEvents as it should, but the inner bean doesn't, even though it implements the ApplicationListener... Is this a bug or a design decision? I am using Spring 1.2.3
Working...
X