i used hasAnyRole('ROLE_ADMIN','ROLE_USER')
but i was getting bean creation below error
Error creating bean with name 'org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0': Cannot create inner bean '(inner bean)' of type [org.springframework.security.web.access.expression.ExpressionBasedFilterInvocationSecurityMetadataSource] while setting bean property 'securityMetadataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#2': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.security.web.access.expression.ExpressionBasedFilterInvocationSecurityMetadataSource]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: Expected a single expression attribute for [/user/*]
then i tried
access="hasRole('ROLE_ADMIN') or hasRole('ROLE_USER')"
and it's working fine for me.
as one of my user is admin as well as user.
for this you need to add use-expressions="true" auto-config="true"
followed by http tag
<http use-expressions="true" auto-config="true" >.....</http>