开发者

create new spring annotation

I'm developing an application in Sp开发者_运维百科ring which has numerous methods in the controller, and are mapped to various URL using @RequestMapping.

Some of these methods (and hence url) are accessible to some user roles, and not to others. Can I create annotations, and annotate these methods so that only privileged users have access to right methods, while not to the others?

Thanks in advance.


I am not sure if creating new annotations is what you really need. You could probably use Spring Security and its annotations. Please take a look here to see if it is what you are looking for.


You can use Spring Security and its annotations, restrict access to some methods. This Blog post show some features of annotations used with Spring Security 3.

Have a look at this question and answer, to see how you build your own annotations on top of spring security.

See also the documentation of Spring Security 3.1, Chapter Expression-Based Access Control.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜