spring-cloud-samples / feign-eureka

Example of using feign with eureka
236 stars 165 forks source link

feign client from a jar not work? #2

Closed Dreampie closed 8 years ago

Dreampie commented 8 years ago

my eureka-server

Application AMIs Availability Zones Status USER-SERVICE-PROVIDER n/a (1) (1) UP (1) - Dreampie-MacBook-Pro-2.local:user-service-provider:9090 VIDEO-SERVICE-PROVIDER n/a (1) (1) UP (1) - Dreampie-MacBook-Pro-2.local:video-service-provider:9091

service for eureka-server https://github.com/Dreampie/cloud-service dependency feign and annotation in this project

@FeignClient("video-server-provider")
public interface VideoService {
  VideoEntity getById(String id);
}

feign client for eureka-server https://github.com/Dreampie/cloud-api dependency on cloud-service project and @EnableFeignClients

eureka-server and config-server https://github.com/Dreampie/cloud-server

spencergibb commented 8 years ago

This is not the right repo to report this. "not work" isn't enough for us to go on. What actually happens? 404? 500? nothing? exceptions?

spencergibb commented 8 years ago

Also spring cloud 1.0.x is not compatible with spring-boot 1.3.x, it requires 1.2.x. The Brixton.MX milestones are compatible with spring boot 1.3

Dreampie commented 8 years ago
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.dreampie.service.user.UserService cn.dreampie.api.user.UserController.userService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cn.dreampie.service.user.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

//spring cloud starter 1.0.2.RELEASE  spring boot plugin  1.2.7.RELEASE
Dreampie commented 8 years ago

I found the answer @EnableFeignClients(basePackages = {"my.external.feign.client.package", "my.local.package"}). thank you.