SpringBoot整合myBatis 报错
@EnableAutoConfiguration
@ComponentScan
@MapperScan("dao")
@EnableTransactionManagement(proxyTargetClass = true)
@SpringBootApplication
public class DeployTestApplication extends SpringBootServletInitializer {
@Override
protected 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;
换成这个包