Annotation Interface EnableMethodSecurity
@Retention(RUNTIME)
@Target(TYPE)
@Documented
@Import(org.springframework.security.config.annotation.method.configuration.MethodSecuritySelector.class)
public @interface EnableMethodSecurity
Enables Spring Security Method Security.
- Since:
- 5.6
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionboolean
Determines if JSR-250 annotations should be enabled.org.springframework.context.annotation.AdviceMode
Indicate how security advice should be applied.boolean
Determines if Spring Security'sPreAuthorize
,PostAuthorize
,PreFilter
, andPostFilter
annotations should be enabled.boolean
Indicate whether subclass-based (CGLIB) proxies are to be created as opposed to standard Java interface-based proxies.boolean
Determines if Spring Security'sSecured
annotation should be enabled.
-
Element Details
-
prePostEnabled
boolean prePostEnabledDetermines if Spring Security'sPreAuthorize
,PostAuthorize
,PreFilter
, andPostFilter
annotations should be enabled. Default is true.- Returns:
- true if pre/post annotations should be enabled false otherwise
- Default:
- true
-
securedEnabled
boolean securedEnabledDetermines if Spring Security'sSecured
annotation should be enabled. Default is false.- Returns:
- true if
Secured
annotation should be enabled false otherwise
- Default:
- false
-
jsr250Enabled
boolean jsr250EnabledDetermines if JSR-250 annotations should be enabled. Default is false.- Returns:
- true if JSR-250 should be enabled false otherwise
- Default:
- false
-
proxyTargetClass
boolean proxyTargetClassIndicate whether subclass-based (CGLIB) proxies are to be created as opposed to standard Java interface-based proxies. The default isfalse
. Applicable only ifmode()
is set toAdviceMode.PROXY
.Note that setting this attribute to
true
will affect all Spring-managed beans requiring proxying, not just those marked with@Cacheable
. For example, other beans marked with Spring's@Transactional
annotation will be upgraded to subclass proxying at the same time. This approach has no negative impact in practice unless one is explicitly expecting one type of proxy vs another, e.g. in tests.- Returns:
- true if subclass-based (CGLIB) proxies are to be created
- Default:
- false
-
mode
org.springframework.context.annotation.AdviceMode modeIndicate how security advice should be applied. The default isAdviceMode.PROXY
.- Returns:
- the
AdviceMode
to use - See Also:
-
AdviceMode
- Default:
- PROXY
-