【Spring Boot】Error creating bean with name 'servletEndpointRegistrar' defined in class

org.springframework.context.ApplicationContextException: Unable to start
web server; nested exception is java.lang.RuntimeException:
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'servletEndpointRegistrar' defined in class path resource
[org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed;
nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate
[org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'healthEndpoint' defined in class path
resource
[org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed; nested
exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate
[org.springframework.boot.actuate.health.HealthEndpoint]: Factory method
'healthEndpoint' threw exception; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name
'org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthIndicatorAutoConfiguration': Bean instantiation via constructor failed;
nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate
[org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthIndicatorAutoConfigurationEnhancerBySpringCGLIB96597db7]: Constructor
threw exception; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'dataSource': Post-processing of FactoryBean's singleton
object failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'scopedTarget.dataSource' defined in class path resource
[org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested
exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory
method 'dataSource' threw exception; nested exception is
org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class

解决:
这是因为在paohe-v2(Maven项目)中cloud-architecture子模块(Maven Module)包含了关于jdbc数据库连接池多数据源加载引起的。事实上cloud-architecture中并不需要启动时加载多数据源,而配置不存在但启动时Config文件存在所以启动时没有读取到多数据源配置信息导致的报错。

 

你可能感兴趣的:(SpringBoot)