本文主要是介绍DataSource is abstract cant be instantialted,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
SpringBoot整合myBatis 报错
@EnableAutoConfiguration@ComponentScan@MapperScan("dao")@EnableTransactionManagement(proxyTargetClass = true)@SpringBootApplication
public class DeployTestApplication extends SpringBootServletInitializer {@Overrideprotected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {return builder.sources(DeployTestApplication.class);}public static void main(String[] args) {SpringApplication.run(DeployTestApplication.class, args);}@Bean@ConfigurationProperties(prefix = "spring.datasource") //作用:加载application.properties文件中的数据库连接参数public DataSource dataSource(){return new DataSource();}}
这是由于引用的DataSource包不对,
import org.apache.tomcat.jdbc.pool.DataSource;
换成这个包
这篇关于DataSource is abstract cant be instantialted的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!