dataSource' defined in class path resource [org/springframework/boot/autocon
spring boot启动的时候抛出如下异常:
dataSource' defined in class path resource [org/springframework/boot/autocon
Cannot determine embedded database driver class for database type NONEAction:If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).这是因为spring boot 会默认加载
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration 这个类DataSourceAutoConfiguration类使用了@Configuration注解向spring注入了dataSource bean。因为工程中没有关于dataSource相关的配置信息,当spring创建dataSource bean因缺少相关的信息就会报错。
解决办法发是:
在Application类上增加
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})

浙公网安备 33010602011771号