eclipse - Spring MVC Abstract Controller::How to get exact method signature when implementing an abstract controller interface -


i using sts 2.8.1 , spring 3.1.1.release.

i have abstract controller below

public abstract class supercontroller {  @requestmapping(value = "/entity", method = requestmethod.post, headers = "accept=application/xml,application/json")     public abstract @responsebody oauthentity setoauthentity(@requestbody oauthentity oauthentity);  @requestmapping(value = "/entity/{id}", method = requestmethod.get, headers = "accept=application/xml,application/json")     public abstract @responsebody oauthentity getoauthentity(@pathvariable("id") long id); } 

when extend controller in sts gives me method signature below

    @override public oauthentity setoauthentity(oauthentity oauthentity) {     // todo auto-generated method stub     return null; }  @override public oauthentity getoauthentity(long id) {     // todo auto-generated method stub     return null; } 

i understand @requestmapping inherited fine , have tested code (it works!!). want when extend super class should @responsebody, @pathvariable("id") , @requestbody in abstract class.

of course edit manually (that's doing, more elegant way) sub class has method signature below

    @override public @responsebody oauthentity setoauthentity(@requestbody oauthentity oauthentity) {      @override public @responsebody oauthentity getoauthentity(@pathvariable("id") long id) { 

it not killing me frustrating have manually write it. appreciated.

spring 3 did away notion of interitance controllers. advice ditch abstract controller idea , add annotations controllers.

inheritance doesn't make sense in context. want 1 , 1 controller method handling given request mapping in application. there's no need parent/child relationship, in opinion. i'd advise move annotations appropriate controller implementations , remove abstract class.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -