Reputation: 11
I want to simplify this
@Controller
@Scope("prototype")
public class Struts2ActionClass{
...
}
to this
@Struts2Action
public class Struts2ActionClass{
...
}
attempt to avoid foggetting the @Scope("prototype")
Dose anyone have any idea?
Update:
I did this copy the code of @Controller,it seems worked.
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Controller
@Scope("prototype")
public @interface Struts2Action {
}
But why?
Upvotes: 0
Views: 204
Reputation: 2803
I did this copy the code of @Controller,it seems worked.
@Target({ ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) @Controller @Scope("prototype") public @interface Struts2Action { }
It works because that's the way to combine annotations. So now you don't need to write every annotation (Controller, Scope etc.), just the parent one (Struts2Action)
Upvotes: 1