开发者

Spring annotations configuration looks like overhead

开发者 https://www.devze.com 2023-02-13 08:39 出处:网络
I just faced,that in order to use specific annotations for Spring Security, I should explicitely allow them in my config(applicationContext.xml)

I just faced,that in order to use specific annotations for Spring Security,

I should explicitely allow them in my config(applicationContext.xml)

Example:

<sec:global-method-security secured-annotations="enabled" />
<sec:global-method-security jsr250-annotations="enabled" />
...

What advantages do you see in approac开发者_如何学运维h of explicitely declare what annotations

are allowed in our frameworked application?

Looks like overconfiguration,isn't it?


One possible benefit is that it allows Spring Security to throw an exception when desired annotations are not present in the classpath (though it's mostly about JSR-250 annotations, since other annotations are parts of Spring Security itself).

Otherwise Spring Security would have to silently ignore absence of annotations, that may lead to surprising behaviour.

0

精彩评论

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

关注公众号