springboot项目启动出错 Failed to configure a DataSource: 'url' attribute is not specified and no embedde

springboot项目启动出错 Failed to configure a DataSource: 'url' attribute is not specified and no embedde,从字面上的意思没有配置数据源,但是在application.properties中我已经配置了数据库的相关信息了:

## database ##
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=

这时候我在想会不会是没有加载到资源文件,于是我在pom文件的build中加入了如下配置:

		<resources>

			<resource>
				<directory>src/main/resources</directory>
				<includes>
					<include>**/*.properties</include>
					<include>**/*.xml</include>
				</includes>
				<filtering>false</filtering>
			</resource>
		</resources>

这是项目就能够正常启动了。

发布了11 篇原创文章 · 获赞 1 · 访问量 6816

猜你喜欢

转载自blog.csdn.net/u010808777/article/details/102887661