一、出现的bug如下
***************************
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:52803', transport: 'socket'
Process finished with exit code 1
二、解决
1.检查pom文件中的打包方式,删掉就搞定了
2.在application.properies/yml/xml文件中添加数据源配置
3.pom.xml里导入了其它工程的依赖,然后这个其它工程的pom.xml里有需要配置dataSource数据源的依赖,解决办法就是在当前工程导入其他工程依赖时,把其它工程里需要配置dataSource的依赖给exclude掉
4.在启动类配置“@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})“
5.注释pom.xml依赖,同时无需配置“@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})“
总结:出现这种问题应首先在pom文件,yml配置文件中查询问题,可以尝试clean操作清除