Solution of spring cloud eurka registration error in Java

Time:2021-9-22

Error in registering in eurka when learning spring cloud:


Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-10-04 11:15:19.703 ERROR 34860 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
 
***************************
APPLICATION FAILED TO START
***************************
 
Description:
 
Field discoveryClient in cn.itcast.consumer.web.ConsumerController required a bean of type 'com.netflix.discovery.DiscoveryClient' that could not be found.
 
The injection point has the following annotations:
	- @org.springframework.beans.factory.annotation.Autowired(required=true)
 
 
Action:
 
Consider defining a bean of type 'com.netflix.discovery.DiscoveryClient' in your configuration.
 

Error code:


import com.netflix.discovery.DiscoveryClient;
 
@Autowired
private DiscoveryClient discoveryClient;

Error reason: the jar package was imported incorrectly

Correct code:


import org.springframework.cloud.client.discovery.DiscoveryClient;
 
 
@Autowired
private DiscoveryClient discoveryClient;

This is the end of this article about the solution of Java spring cloud eurka registration errors. For more information about Java spring cloud eurka registration errors, please search the previous articles of developeppaer or continue to browse the relevant articles below. I hope you will support developeppaer in the future!

Recommended Today

Supervisor

Supervisor [note] Supervisor – H view supervisor command help Supervisorctl – H view supervisorctl command help Supervisorctl help view the action command of supervisorctl Supervisorctl help any action to view the use of this action 1. Introduction Supervisor is a process control system. Generally speaking, it can monitor your process. If the process exits abnormally, […]