Skip to content

ApplicationListener callbacks to be supported for inner beans as well [SPR-6049] #10718

@spring-projects-issues

Description

@spring-projects-issues

aaron gaalswyk opened SPR-6049 and commented

I have a bean definition like this:

<bean id="mybean" class="com.mycompany.MyBeanImpl">

<security:intercept-methods access-decision-manager-ref="defaultAccessDecisionManager">
<security:protect method="com.mycompany.MyBean.*" access="ROLE_USER"/>
</security:intercept-methods>

</bean>

The MyBeanImpl bean implements both the MyBean interface and the Spring ApplicationListener interface, because it needs the ContextRefreshedEvent to complete some configuration. With the definition done as above, security gets applied correctly, but the ApplicationListener.onApplicationEvent callback fails to ever get invoked. If I comment out the intercept-methods decorator, the callback works again. If I delete the intercept-methods decorator and replace it with a stand-alone global-method-security element, I'm in good shape with both security and the onApplicationEvent callback:

<security:global-method-security access-decision-manager-ref="defaultAccessDecisionManager">
    <security:protect-pointcut access="ROLE_USER"
        expression="execution(* com.mycompany.MyBean.*(..))" />
</security:global-method-security>

Affects: 3.0 M4

Issue Links:

Referenced from: commits 0e1b04d

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions