Spring Security provides support for JSR-250 annotation security. That means we can use javax.annotation.security.RolesAllowed in the place of Spring's @Secured annotation.
Example
We are going to reuse our last example. We just need to replace @Secured with @RolesAllowed in the service class and enabled JSR-250 annotation in Java config class. We will also need to include JSR-250 API maven dependency.