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头

解决办法

相关推荐
Java致死1 小时前
设计模式Java
java·开发语言·设计模式
源码方舟1 小时前
SpringBoot + Shiro + JWT 实现认证与授权完整方案实现
java·spring boot·后端
2401_cf4 小时前
为什么hadoop不用Java的序列化?
java·hadoop·eclipse
帮帮志4 小时前
idea整合maven环境配置
java·maven·intellij-idea
LuckyTHP5 小时前
java 使用zxing生成条形码(可自定义文字位置、边框样式)
java·开发语言·python
热河暖男5 小时前
【实战解决方案】Spring Boot+Redisson构建高并发Excel导出服务,彻底解决系统阻塞难题
spring boot·后端·excel
无声旅者7 小时前
深度解析 IDEA 集成 Continue 插件:提升开发效率的全流程指南
java·ide·ai·intellij-idea·ai编程·continue·openapi
Ryan-Joee8 小时前
Spring Boot三层架构设计模式
java·spring boot
Hygge-star8 小时前
【数据结构】二分查找5.12
java·数据结构·程序人生·算法·学习方法