0


ERROR:o.s.b.d.LoggingFailureAnalysisReporter解决办法

ERROR:o.s.b.d.LoggingFailureAnalysisReporter解决办法

APPLICATION FAILED TO START

Description:Failedtoconfigure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.

Reason:Failedtodetermine a suitable driver classAction:Consider the following:If you want an embedded database (H2,HSQL or Derby), please put it on the classpath.
If you have database settings tobe loaded from a particular profile you may need toactivate it (no profiles are currently active).Process finished withexit code 1

@SpringBootApplication定义是个Spring Boot应用;@EnableDiscoveryClient开启Spring Cloud的服务注册与发现,由于这里引入了spring-cloud-starter-alibaba-nacos-discovery模块,所以Spring Cloud Common中定义的那些与服务治理相关的接口将使用Nacos的实现。

这里需要注意:如果直接使用@SpringBootApplication注解,后面不加参数,启动的时候会报错,如下:
在这里插入图片描述
经过排查:是因为springboot启动时会自动注入数据源和配置jpa

所以解决方法:

在@SpringBootApplication中排除其注入
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})


简单的在Controller文件中写一个@RequestMapping(“/login”)打头的

@RestController@RequestMapping("/login")publicclassUserController{@GetMappingpublicStringgetUsers(){return"Hello Spring Security";}}

启动Application之后,无法成功运行,报错o.s.b.d.LoggingFailureAnalysisReporter ERROR;

解决办法:
在Application中将仅仅的@SpringBootApplication修改成:
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})

@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
标签: spring boot java spring

本文转载自: https://blog.csdn.net/weixin_43333233/article/details/128543696
版权归原作者 kuku0jie 所有, 如有侵权,请联系我们删除。

“ERROR:o.s.b.d.LoggingFailureAnalysisReporter解决办法”的评论:

还没有评论