我的解决方式是:
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
即在@SpringBootApplication后,加上(exclude = DataSourceAutoConfiguration.class)。
我也还是SpringBoot新手,还不知道其中的奥妙,看了别人的方法用了可行,就记一下吧。
我的报错信息如下:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-16 16:54:21.280 ERROR 28492 --- [ main] o.s.b.d.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).