JavaSpringBoot在编译打包时一些xml文件找不到,数据库配置找不到等问题。

在Java SpringBoot项目编译或打包时,可能会遇到XML映射文件未找到、数据库配置丢失及静态文件访问问题。错误包括mapper.xml未匹配、DataSource未配置及静态资源不可访问。解决方案包括检查target目录,确保pom.xml包含对resources的编译配置,或将缺失文件手动复制到target目录下。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在编译启动项目或者打包maven项目时有时会遇到:

1.明明代码都是正确的,mapper.xml文件映射也正确,但是报出mapper中sql语句未匹配,找不到xml文件,Invalid bound statement (not found)。

2.mysql配置是对的,SQLDriver和url也都配置了,但是报出找不到数据库配置。

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
 If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
 If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

3.找不到static下面静态文件,明明就在包里,却访问不到。

解决方法:

去检查编译后的target文件夹

看看

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值