spring配置文件第一行导致读取配置失败

遇到读取配置存在问题,尤其当配置到第一行

通过spring执行测试类,没有问题,但是相同配置启动项目时,老找不到JdbcTemplate

使用配置:

复制代码
spring.shardingsphere.datasource.names=master,slave

spring.shardingsphere.datasource.master.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.master.driver-class-name=com.mysql.jdbc.Driver
****

后打断点,发现读取的spring.shardingsphere.datasource.names存在问题,进而导致后续问题的产生。

原因是存在utf-8的bom头导致,在变量前面存在 ï>>¿ 这个就是bom头

解决办法

相关推荐
Penge6665 小时前
Go 接口编译期断言
后端
我是一颗柠檬6 小时前
【MySQL全面教学】MySQL面试高频考点汇总Day15(2026年)
数据库·后端·mysql·面试
橙淮6 小时前
并发编程(六)
java·jvm
拽着尾巴的鱼儿6 小时前
springboot openfeign 自定义feign 接口重试机制
java·spring boot·后端
白露与泡影6 小时前
2026大厂Java面试题大全!牛客网最新版
java·开发语言
Ceelog6 小时前
久坐党自救指南:屏幕前 8 小时,身体到底在经历什么
前端·后端
EntyIU7 小时前
JVM内存与GC笔记
java·jvm·笔记
XS0301067 小时前
并发编程 六
java·后端
yaoxin5211237 小时前
419. 现代 Java IO 最佳实践 - 写入文本文件
java·windows·python
雪宫街道8 小时前
synchronized 锁的范围:对象锁、类锁与代码块锁
java·jvm·后端·面试