一、该问题的重现步骤是什么?
创建空项目,只有一个启动文件,没有application配置文件
@BladeCloudApplication public class DemoApplication { public static void main(String[] args) { BladeApplication.run("demo", DemoApplication.class, args); } }
2. 修改 pom 文件,增加依赖
blade-common blade-core-boot
3.
二、你期待的结果是什么?实际看到的又是什么?
期待结果:此服务不需要服务库,不需要配置数据源也要能正常启动;
实际看到:不配置数据源服务启动失败,提示 DataSource url 错误;
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
bladex3, windows
四、请提供详细的错误堆栈信息,这很重要。
INFO: Sentinel log name use pid is: false
INFO: Sentinel log level is: INFO
2022-09-02 15:09:15.357 WARN 10644 --- [ main] io.undertow.websockets.jsr : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2022-09-02 15:09:15.373 INFO 10644 --- [ main] io.undertow.servlet : Initializing Spring embedded WebApplicationContext
2022-09-02 15:09:15.373 INFO 10644 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2486 ms
2022-09-02 15:09:15.529 INFO 10644 --- [ main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource
2022-09-02 15:09:15.732 WARN 10644 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webMvcMetricsFilter' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/servlet/WebMvcMetricsAutoConfiguration.class]: Unsatisfied dependency expressed through method 'webMvcMetricsFilter' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleMeterRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleMetricsExportAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourcePoolMetadataMeterBinder' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/jdbc/DataSourcePoolMetricsAutoConfiguration$DataSourcePoolMetadataMetricsConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourcePoolMetadataMeterBinder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/alibaba/druid/spring/boot/autoconfigure/DruidDataSourceAutoConfigure.class]: Invocation of init method failed; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine suitable jdbc url
2022-09-02 15:09:15.763 INFO 10644 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-09-02 15:09:15.779 ERROR 10644 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine suitable jdbc url
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (the profiles dev are currently active).
五、若有更多详细信息,请在下面提供。
扫一扫访问 Blade技术社区 移动端