You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
getMappingForMethod failed when implement a interface method(with @RequestMapping) in super class [SPR-17223] #21756
in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement
These codes seems like try to find @ReqeuestMapping in super class or interface of witch i defined my 'ranking' method
Of course they can't find @ReqeuestMapping because the 'ranking' method is defined in AbstractOrderService, and AbstractOrderService is not implements CunstomerOrderClient.
But, with the increasement of entities and common APIs number. We met with a problem.Every controller declared the APIs as many as the methods defined in CommonController.
In our production scenario, Most controllers(90%+) only need some of mothods(about 30%-50%) witch defined in CommonController.
I tried to split CommonController to spread classes like CommonCreateOrUpdateController, CommonQueryController, but it seems not very helpful.
After a few research on github and stackoverflow, I found that APIs defined in interface is supported.
So now I can declare APIs like this with this PR :
So the issue here is that the implementing method is on an abstract class that isn't itself implementing the interface. Would use of delegate classes be a better fit, especially in a situation akin to multiple inheritance (i.e. "Most controllers(90%+) only need some of methods (about 30%-50%) which are defined in CommonController")?
So the issue here is that the implementing method is on an abstract class that isn't itself implementing the interface. Would use of delegate classes be a better fit, especially in a situation akin to multiple inheritance (i.e. "Most controllers(90%+) only need some of methods (about 30%-50%) which are defined in CommonController")?
My purpose is let one Controller/Service register some common API by only Implement the common Interfaces what they need. Instead of implement every common API or call several Repositories
Im not quiet sure about the 'delegate classes'
If there is other ways to do so by minimum redundancy code. Please give me some hints
Sorry for the delayed response. To me it still feels like a case of multiple inheritance and the path for that in Java is through delegation. The scenario however is a bit involved and although you've provided some snippets, it's still not completely clear.
It would be best to provide an actual sample, sufficiently representative of the problem, which would allow us to reason about alternative approaches or possible changes in the framework. While the changes proposed in #1950 may be working for you, they could also cause side effects such as is the case with #22028.
I'm closing as possibly outdated, but we can re-consider if this is still of interest.
in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement
Activity
spring-projects-issues commentedon Sep 4, 2018
s-mop commented
I wonder if you mind me creating a PR.
spring-projects-issues commentedon Sep 20, 2018
s-mop commented
Let me explain why I need declared methods in interfaces and implemented in super class
Usually we need declare a lot of APIs for various entities in one or more controllers like:
To avoid redundant code we can declare a parent class like this:
But, with the increasement of entities and common APIs number. We met with a problem.Every controller declared the APIs as many as the methods defined in CommonController.
In our production scenario, Most controllers(90%+) only need some of mothods(about 30%-50%) witch defined in CommonController.
I tried to split CommonController to spread classes like CommonCreateOrUpdateController, CommonQueryController, but it seems not very helpful.
After a few research on github and stackoverflow, I found that APIs defined in interface is supported.
So now I can declare APIs like this with this PR :
It works like a charm with other framework(like Hibernate-Validator,Swagger2) on our staging environment.
I saw the fix version of this issue is updated from 5.1 GA to 5.X backlog .But, at last, I realy hope it can be merged in an earlier version
Thank you for your patience and please let me know if there are any inadequacies.
spring-projects-issues commentedon Sep 25, 2018
s-mop commented
Juergen Hoeller any advice?
rstoyanchev commentedon Apr 2, 2020
So the issue here is that the implementing method is on an abstract class that isn't itself implementing the interface. Would use of delegate classes be a better fit, especially in a situation akin to multiple inheritance (i.e. "Most controllers(90%+) only need some of methods (about 30%-50%) which are defined in CommonController")?
s-mop commentedon Apr 30, 2020
My purpose is let one Controller/Service register some common API by only Implement the common Interfaces what they need. Instead of implement every common API or call several Repositories
Im not quiet sure about the 'delegate classes'
If there is other ways to do so by minimum redundancy code. Please give me some hints
rstoyanchev commentedon Dec 3, 2021
Sorry for the delayed response. To me it still feels like a case of multiple inheritance and the path for that in Java is through delegation. The scenario however is a bit involved and although you've provided some snippets, it's still not completely clear.
It would be best to provide an actual sample, sufficiently representative of the problem, which would allow us to reason about alternative approaches or possible changes in the framework. While the changes proposed in #1950 may be working for you, they could also cause side effects such as is the case with #22028.
I'm closing as possibly outdated, but we can re-consider if this is still of interest.