SpringBoot整合redis实现数据存入redis的时候,报错了!!!
错误:
错误描述:
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
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).
错误原因是没有配置数据库连接相关的一些属性:
解决办法:1--去配置文件中配置数据库连接的属性,如果没有用到配置连接 可以采用方法2;
2--通过在主程序中取消数据库的自动配置:
如:就会自动排除数据库的一些相关配置:
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}