java - Override value of @PreAuthorize using @AliasFor -


i have following combined custom annotation springs @preauthorize annotation,

@requestmapping(         produces = mimetypeutils.application_json_value + ";charset=utf-8",         method = requestmethod.get) @responsebody @preauthorize(value = "hasrole('permitall()')") @responsestatus(httpstatus.ok) @target({elementtype.method, elementtype.type}) @retention(retentionpolicy.runtime) public @interface {      @aliasfor(annotation = requestmapping.class, attribute = "value")     string[] value() default {};      @aliasfor(annotation = preauthorize.class, attribute = "value")     string authorize() default "permitall()"; } 

and i've got following client using it

@get(value = "/users", authorize = "hasrole('role_get_users')") public list<user> retrieveusers() {    // body } 

as can see purpose allow clients of @get annotation override @preauthorize can provide role require for.

i din't have far problem using @aliasfor, in example @requestmapping working, unfortunately not override value of @preauthorize , can still access resources default value permitall().

i wonder first of why not work, , second if possible make work?


Comments