Spring-cloud-netflix: Why @EnableFeignClients can't be annotated on super class?

Created on 28 Feb 2017  路  4Comments  路  Source: spring-cloud/spring-cloud-netflix

For abstraction, I wrote a BaseApplication which contains all needed annotation as follow:

@SpringBootApplication
@EnableDiscoveryClient
@EnableEurekaClient
@EnableHystrix
@EnableAutoConfiguration
@EnableSwagger2
@EnableFeignClients
@EnableZuulProxy
public class BaseApplication {
    public BaseApplication() {
    }
}

All worked well except @EnableFeignClients.

I must re-annotated @EnableFeignClients on the sub-class:

@EnableFeignClients
public class ConsumerApplication extends BaseApplication {...}

Does this cute hole should be fixed or updated in the future?

question

All 4 comments

@EnableFeignClients does classpath scanning from the package of the class it is annotated on. In this case you actual feign clients are not located at or under BaseApplications package.

thanks that really help me today. Just to be sure. Is it possible to specify another classpath scanning base?

There is an attribute on the annotation

Closing due to age of the question. If you would like us to look at this issue, please comment and we will look at re-opening the issue.

Was this page helpful?
0 / 5 - 0 ratings