-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
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:
- Inner bean behind BeanFactoryPostProcessor should be able to receive application events [SPR-14783] #19349 Inner bean behind BeanFactoryPostProcessor should be able to receive application events
Referenced from: commits 0e1b04d