Description: Failed to configure a DataSource: 'url' attribute is not specified 的解决办法

今天在用springboot时出现了一个错误
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).

解决办法:

@SpringBootApplication
public class Springboot03ThymeleafAjaxApplication {

	public static void main(String[] args) {
		SpringApplication.run(Springboot03ThymeleafAjaxApplication.class, args);
	}
}

将@SpringBootApplication改为

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})

就可以了

你可能感兴趣的:(错误总结)