Skip to content

Instantly share code, notes, and snippets.

@odrotbohm
Last active December 14, 2015 07:08
Show Gist options
  • Save odrotbohm/5047742 to your computer and use it in GitHub Desktop.
Save odrotbohm/5047742 to your computer and use it in GitHub Desktop.
Lazy-init config for SpringSecurity PermissionEvalutor implementations
<security:global-method-security pre-post-annotations="enabled">
<security:expression-handler ref="methodExpressionHandler"/>
</security:global-method-security>
<bean id="methodExpressionHandler" class="org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler">
<property name="permissionEvaluator">
<bean class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="targetSource">
<bean class="org.springframework.aop.target.LazyInitTargetSource">
<property name="targetBeanName" value="evaluator" />
</bean>
</property>
<property name="proxyInterfaces" value="org.springframework.security.access.PermissionEvaluator" />
</bean>
</property>
</bean>
<bean id="evaluator" class="security.RepositoryPermissionEvaluator" autowire="byType" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment