Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource cou...

搭建SpringBoot+MyBatis时,idea运行正常,使用mvn package打包失败,错误如下


上面的描述是说没有配置数据源,未能确定合适的驱动程序类,但是我在application.yml中都已经配置了


按网上所说的方案,在启动类上加上@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})屏蔽自动配置,运行报SqlSession之类的错误,由于屏蔽了自动装配数据源,启动肯定会报错,后来自定义了数据源配置文


重新rebuild project,然后打包成功

你可能感兴趣的:(Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource cou...)