Get java annotation attribute value on Spring SpEL expression -


i need implement authorization expression on multiple controllers. have decided create personalized annotation facilitates use. problem authorization expression requires parameter (an id) can obtained in different ways in each controller.

i put annotation:

@target({elementtype.method, elementtype.type}) @retention(retentionpolicy.runtime) @documented @preauthorize("@authorizationservice.hasadminrole() || ( @authorizationservice.hasparentrole() && @authorizationservice.isyourson(#son) )") public @interface onlyaccessforadminorparentoftheson {     string son() default ""; } 

the problem not know how value of "son" attribute of annotation use in spel authorization expression.

the notation use follows:

@onlyaccessforadminorparentoftheson(son = "#id") @onlyaccessforadminorparentoftheson(son = "#socialmedia.son") 

someone knows how can fix this. in advance.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -