ho abilitato mia nuvola molla per feignClients come questo:Utilizzando primavera nuvola fingere cause java.lang.NoClassDefFoundError: fingere/Logger
@Configuration
@EnableAutoConfiguration
@RestController
@EnableEurekaClient
@EnableCircuitBreaker
@EnableFeignClients
public class SpringCloudConfigClientApplication {
}
Ma oon come aggiungo enableFeignClients, ho ottenuto questo errore durante la compilazione,
java.lang.NoClassDefFoundError: feign/Logger
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2688)
at java.lang.Class.getDeclaredMethods(Class.java:1962)
mio POM è
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>1.0.0.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.SpringCloudConfigClientApplication</start-class>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
</dependencies>
al fine di risolvere problema logger fingere, quali altre depende devo aggiungere al POM?
Grazie
Grazie @spencergibb, in base alla proposta, ha funzionato dopo il cambio il mio pom. Ora ho un altro problema con l'utilizzo di FeignClient. Si prega di vedere di seguito:
@Autowired
StoreClient storeClient;
@RequestMapping("/stores")
public List<Store> stores() {
return storeClient.getStores();
}
e l'interfaccia è:
@FeignClient("store")
public interface StoreClient {
@RequestMapping(method = RequestMethod.GET, value = "/stores")
List<Store> getStores();
}
L'entità negozio è:
public class Store {
private long id;
private String name;
private String zip;
public Store(long id, String name, String zip) {
this.id = id;
this.name = name;
this.zip = zip;
}
}
Ora, quando a recuperare in URL, ho ottenuto questo errore,
ue Jun 09 15:30:10 PDT 2015
There was an unexpected error (type=Internal Server Error, status=500).
Could not read JSON: No suitable constructor found for type [simple type, class demo.entity.Store]: can not instantiate from JSON object (need to add/enable type information?) at [Source: [email protected]; line: 1, column: 3] (through reference chain: java.util.ArrayList[0]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found for type [simple type, class demo.entity.Store]: can not instantiate from JSON object (need to add/enable type information?) at [Source: [email protected]; line: 1, column: 3] (through reference chain: java.util.ArrayList[0])
Sembrava che l'errore qui sia recuperato. L'elenco non può essere convertito in classe. Quindi, per utilizzare FeignClient, qualsiasi altro mapper che dobbiamo includere per convertire JSON in oggetti?
Grazie
Risposta me, dover mettere un costruttore vuoto di default nel classs soggetto al fine di rendere il mapper di lavoro. Grazie – user3006967