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 a suitable driver class
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 (no profiles are currently active).
Process finished with exit 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")
public class UserController {
@GetMapping
public String getUsers() {
return "Hello Spring Security";
}
}
启动Application之后,无法成功运行,报错o.s.b.d.LoggingFailureAnalysisReporter ERROR;文章来源:https://www.toymoban.com/news/detail-401089.html
解决办法:
在Application中将仅仅的@SpringBootApplication修改成:
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})文章来源地址https://www.toymoban.com/news/detail-401089.html
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
到了这里,关于ERROR:o.s.b.d.LoggingFailureAnalysisReporter解决办法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!