У меня есть следующий pom-файл:
Код: Выделить всё
4.0.0
xx.yyy
component
1.0.0
component
1.8
3.1.1
3.6.7
Greenwich.SR4
org.springframework.boot
spring-boot-starter-parent
2.1.10.RELEASE
org.springframework.boot
spring-boot-starter-actuator
org.springframework.boot
spring-boot-starter-amqp
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-tomcat
org.springframework.boot
spring-boot-starter-jetty
org.springframework.cloud
spring-cloud-starter-config
org.springframework.cloud
spring-cloud-starter-openfeign
......
org.springframework.cloud
spring-cloud-dependencies
${spring-cloud.version}
pom
import
......
Код: Выделить всё
@SpringBootApplication(scanBasePackages = {"xx.yyy", "xx.yyy.rest.client"}, exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
@EnableAsync
@Import({P2OrchestratorApplicationConfig.class})
public class P2OrchestratorApplication {
public static void main(String[] args) {
SpringApplication.run(P2OrchestratorApplication.class, args);
}
}
Код: Выделить всё
@Configuration
@EnableFeignClients()
@ImportAutoConfiguration({FeignAutoConfiguration.class})
public class FeignConfig {
@Bean
public OkHttpClient client() {
return new OkHttpClient();
}
@Bean
public Logger.Level feignLoggerLevel() {
return Logger.Level.FULL;
}
@Bean
public Contract feignContract() {
return new feign.Contract.Default();
}
}
Код: Выделить всё
@FeignClient(name="legacyClient", value = "legacyClient", url = "${uri.microservice.legacy}", configuration = FeignConfig.class)
public interface LegacyClient {
@PatchMapping(value = "/legacy/xxx/cleanLine/{authorizationCode}", produces = { MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity cleanLine(@PathVariable("authorizationCode") Long authorizationCode, @RequestParam(required = true) Long lineNumber);
}
Код: Выделить всё
@Log4j
@Component("p2ProcessAlgorithm")
public class P2ProcessAlgorithm {
@Autowired
@Qualifier("legacyClient")
private LegacyClient legacyClient;
public final void process(){
Long authorizationCode = 123L;
Long lineNumber = 1L;
Boolean isClean= this.legacClient.cleanLine(authorizationCode, lineNumber);
......
}
Код: Выделить всё
***************************
APPLICATION FAILED TO START
***************************
Description:
Field legacyClient in xxx.yyy.p2.structure.P2ProcessAlgorithm required a bean of type 'xxx.yyy.rest.client.LegacyClient' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
- @org.springframework.beans.factory.annotation.Qualifier(value=p2AsyncOrchestratorService)
Action:
Consider defining a bean of type 'xxx.yyy.rest.client.LegacyClient' in your configuration.
У вас есть есть идеи?
Заранее спасибо
Подробнее здесь: https://stackoverflow.com/questions/590 ... t-be-found