I am now extracting my project to three parts: a core project used for US & India with features that can by applied for both of them, a US project with US features only, a India project with India features only.
But now I get a problem that in spring boot. In US, there are two new fileds added to the original core entity, so the input object changed from PromSeckillRequest to UsPromSeckillRequest,
Now I want to override my seckill interface, I have no good choice but first write an abandon seckill interface and then write another seckill interface that I want. code below:
@RestController("usShoppingController")
@RequestMapping(value = "/prom", method = RequestMethod.POST)
public class UsPromShoppingController extends PromShoppingController {
@RequestMapping("/seckillAbandon")
@Override
public JsonResponse seckill(@Valid @RequestBody PromSeckillRequest request) {
return null;
}
@RequestMapping("/seckill")
public JsonResponse usSeckill(@Valid @RequestBody UsPromSeckillRequest request) {
return super.seckill(request);
}
}
But what my goal is like below:
@RestController("usPromShoppingController")
@RequestMapping(value = "/prom", method = RequestMethod.POST)
public class UsPromShoppingController extends PromotionShoppingController {
@RequestMapping("/seckill")
@Override
public JsonResponse usSeckill(@Valid @RequestBody UsPromSeckillRequest request) {
return super.seckill(request);
}
}
Is there any good resolution for this? I am using spring boot.
EDIT:
I checked with google and found that, it's a weak point for spring boot until now. I don't know why spring boot don't pay full supportage for this point. I think maybe we can do it like this only.
I want to add a wrapper to solve this, but seems I can only change the request to HashMap type Or String type, But this is not what I want Because it will hard to valid the input request params.