私はspring 4RESTを使用しています。
私にはベースがclassあり、他の多くclassは同じように拡張しています。たとえば、Employee はベースclassであり、他のクラス hr、engineer、trainer などは従業員を拡張します。
REST APIさまざまなタイプの従業員を作成するために作成する必要があります。あらゆるタイプの従業員を受け入れるものですinterface。サブタイプごとにPOST異なるものを作成することはできません。interfaceベースから、サブタイプが何であるかを知っています。
@RequestMapping(value= "/test/{employeeType}", method = RequestMethod.POST)
public void createEmp(@RequestBody Employee employee){
//If type is HR, I want to cast to HR type
//Is there any way we can take generic object in spring rest and then manage internally ?
}