项目启动类
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
@SpringBootApplication
public class JinlongSystemWebApplication {
public static void main(String[] args) {
SpringApplication.run(JinlongSystemWebApplication.class, args);
}
}
application.properties配置
server:
port: 8090
spring:
application:
name: jinlong-system
datasource:
type: com.alibaba.druid.pool.DuridDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/jinlong?useUnicode=true&characterEncoding=utf-8
username: root
password:
mybatis:
mapper-locations: classpath:mybatis/mapper/*/*.xml
启动报错:
Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-co
新搭建的SpringBoot项目,启动报错Failed to determine suitable jdbc url
最新推荐文章于 2024-08-25 10:45:13 发布
本文介绍了SpringBoot项目启动时遇到的`Failed to auto-configure a DataSource`错误,原因是缺少数据库驱动配置。解决方案包括在pom.xml中添加MySQL驱动依赖、检查资源配置以及排除DataSource自动配置。同时提供了在IDEA中排查pom文件是否正确打包的建议,以及通过注解排除数据源自动配置的临时解决办法。
摘要由CSDN通过智能技术生成