自己疏忽在启动类里面加了@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})不加载数据库 导致对应的bean没有加载成功 去掉就好了。