문제

I provide a highly customisable application to my clients which is working totally by itself. But If one my client wants to overwrite any Controller, I want to replace my implementation by theirs. However just overwriting the controller causes an ambiguous definition of mappings.

I have been using Component Scanning to load beans.

The potential solutions came to my mind are:

  1. Using component scanner with excluding by a custom filter? (This seems not so easy)
  2. Using a xxxxPostProcessor to remove some beans? (How?)

Any help?

도움이 되었습니까?

해결책 2

I have followed these steps:

  1. Created a custom annotation: @Devoted
  2. Created a custom ImportBeanDefinitionRegistrar. Iterated already registered bean definitions to find out `@Devoted @Controller's and removed them.

Based on a request I will provide implementation details.

다른 팁

If I got your Question properly,

You can differ implementation by changing URL to particular Implementation name

Say Telecom is interface and AirtelImpl and RelianceImpl are Controllers then

Your request mapping

@RequestMapping(value= "/airtel/doBilling")
@RequestMapping(value= "/reliance/doBilling")

In this way, Implementation flow will differ.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top