シンプルな社内フレームワークを使用して、リクエストのクラス/メソッドを決定するためにクエリパラメーターが使用されるレガシーシステムがあります。例えば
/endpoint?product=foo&action=bar&amount=1.0
/endpoint?product=foo&action=baz&amount=1.0
そして、製品のすべてのアクションを1つのクラスにマップして、配管を大幅に簡素化できるようにしたいと思います。
@Controller
@RequestMapping("/endpoint/foo/**")
public class FooController {
@AutoWire
private FooProductService s; // one of many beans that have to be wired into lots of classes
@RequestMapping("/bar")
public void bar(@PathVariable String amount, Model model) {
// implementation omitted
}
@RequestMapping("/baz")
public void baz(@PathVariable String amount, Model model) {
// implementation omitted
}
}
これは公開 API であるため、公開 API を変更することはできません -> URL を変更することはできません。
おそらくこれは、構成を使用して、アスペクトとして、または独自の注釈のないカスタム フレームワークでさえも実行できると考えました。