spring cloud upgrade steps | Description of the problem

1.Feign call error The bean 'XXX.FeignClientSpecification', defined in null, could not be registered .... solution

Description:

The bean 'DATACENTER-ZUUL-GATEWAY.FeignClientSpecification', defined in null, could not be registered. A bean with that name has already been defined in null and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

Option One:

After the upgrade Spring Boot 2.1.1Spring Cloud Greenwich.M3 version, the same definition in two categories Feign within the interface name, @FeignClient (name = the same name will be given, in the previous version will not prompt error, error contents The bean 'XXX.FeignClientSpecification', defined in null, could not be registered. A bean with that name has already been defined in null and overriding is disabled. "

It is said that registration Feign, there is the name of the same name feign duplicate registration.

Feign solution is to call the same name that is cross-service call, the interface with a service, do not write dispersed in multiple interfaces class, but into the same class as defined in excuse to call.

Option II :( pro-test feasible)

@FeignClient ( "same service name") on multiple interfaces will complain,overriding is disabled

In application.yml configure:

spring:
  main:
    allow-bean-definition-overriding: true

2. Failed to bind properties under 'spring.datasource.druid.driver' to java.sql.Driver:
    Property: spring.datasource.druid.driver
    Value: com.mysql.jdbc.Driver
    Origin: class path resource [application.yml]:5:20
    Reason: No converter found capable of converting from type [java.lang.String] to type [java.sql.Driver]

java.lang.TypeNotPresentException: Type org.springframework.jdbc.CannotGetJdbcConnectionException not present
	at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117)
	at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
	at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
	at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
	at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
	at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
	at sun.reflect.generics.repository.ClassRepository.getSuperclass(ClassRepository.java:90)
	at java.lang.Class.getGenericSuperclass(Class.java:777)
	at org.springframework.core.ResolvableType.getSuperType(ResolvableType.java:466)
	at org.springframework.core.ResolvableType.as(ResolvableType.java:455)
	at org.springframework.core.ResolvableType.forClass(ResolvableType.java:1037)
	at org.springframework.boot.diagnostics.AbstractFailureAnalyzer.getCauseType(AbstractFailureAnalyzer.java:58)
	at org.springframework.boot.diagnostics.AbstractFailureAnalyzer.analyze(AbstractFailureAnalyzer.java:34)
	at org.springframework.boot.diagnostics.FailureAnalyzers.analyze(FailureAnalyzers.java:114)
	at org.springframework.boot.diagnostics.FailureAnalyzers.reportException(FailureAnalyzers.java:107)
	at org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:848)
	at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:832)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
	at com.gla.datacenter.consumer.DataCenterConsumer.main(DataCenterConsumer.java:17)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.CannotGetJdbcConnectionException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
	... 25 common frames omitted

Solution 

Modify application.yml file old version of
the Spring:
  the DataSource:
  Driver: com.mysql.jdbc.Driver
modifications to
the Spring:
  the DataSource:
    Druid:
      Driver-class-name: com.mysql.jdbc.Driver
 

Published 223 original articles · won praise 145 · views 290 000 +

Guess you like

Origin blog.csdn.net/zzhuan_1/article/details/84882756