Error starting ApplicationContext. To display the conditions report re-run your application。。。。
程序员文章站
2022-01-30 20:47:34
...
从springboot官网上通过模版下载了项目,模版里包含了war, mysql, mybatis,下载完成后,直接在本地运行,报错:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-28 14:57:45.822 [main] ERROR o.s.b.diagnostics.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 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).
Disconnected from the target VM, address: '127.0.0.1:27565', transport: 'socket'
Process finished with exit code 1
springboot 2.0+中使用jdbc-url配置数据库URL, 1.5中使用url,不然会导致一个错误。jdbcUrl is required with driverClassName
创建一个DataSourceConfig后,再运行,正常
package com.example.demo.config;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
@Configuration
public class DataSourceConfig {
@Bean("MyDataSource")
@Qualifier("MyDataSource")
@ConfigurationProperties(prefix="spring.datasource")
public DataSource getMyDataSource(){
return DataSourceBuilder.create().build();
}
}
上一篇: Error starting ApplicationContext. To display the conditions report re-run your application with 'de
下一篇: 跨域、vue双向绑定相关面试题
推荐阅读
-
SpringBoot报错:Error starting ApplicationContext. To display the conditions report...........
-
springboot错误:Error starting ApplicationContext. To display the conditions report re-run your applica
-
ApplicationContext.To display the conditions report re-run your application with ‘debug‘ enabled
-
springboot启动报错,Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
-
Error starting ApplicationContext. To display the conditions report re-run your application with 'de
-
Error starting ApplicationContext. To display the conditions report re-run your application with 'de
-
Error starting ApplicationContext. To display the conditions report re-run your application with 'de
-
Error starting ApplicationContext. To display the conditions report re-run your application with ‘de
-
Error starting ApplicationContext. To display the conditions report re-run your application with 'de
-
ApplicationContext.To display the conditions report re-run your application with ‘debug‘ enabled