@ConfigurationProperties 失效

在网上看了好久,就是没有正确的解决方案

先上一波问题代码

@Data
@ConfigurationProperties(prefix = "yt.filter")
public class FilterProperties {
    private List<String> allowPaths;

}

@Slf4j
@Component
@EnableConfigurationProperties({AuthProperties.class, FilterProperties.class})

public class LoginInterceptor implements WebMvcConfigurer {
// public class LoginInterceptor  {
    @Autowired(required = false)
    private AuthProperties props;
    @Autowired(required = false)
    private FilterProperties filterProps;
#  jwt:
#    pubKeyPath: D:/vip/keys/leizhe/id_rsa.pub # 公钥地址
#    cookieName: YT_TOKEN # cookie的名称
#  filter:
#    allowPaths:
#    - /api/auth # 授权中心
#    - /api/search # 商品搜索
#    - /api/user/register #注册
#    - /api/user/check # 检验数据类型
#    - /api/user/send # 发送验证码
#    - /api/user/query # 用户查询
#    - /api/item # 商品页
#    - /item # 商品详情

怎么看怎么没错,真是日了狗了,各种处理都不行

突然想到,由于我这个是公共包进行拦截url的,那么我的yml文件有可能被覆盖?

于是乎,将yml文件换成properties文件,这下就可以了,真正的问题还没有确定下来,先记录一下,以后弄懂了,再来补充

下面是properties文件

#yt:
#  jwt:
#    pubKeyPath: D:/vip/keys/leizhe/id_rsa.pub # 公钥地址
#    cookieName: YT_TOKEN # cookie的名称
#  filter:
#    allowPaths:
#    - /api/auth # 授权中心
#    - /api/search # 商品搜索
#    - /api/user/register #注册
#    - /api/user/check # 检验数据类型
#    - /api/user/send # 发送验证码
#    - /api/user/query # 用户查询
#    - /api/item # 商品页
#    - /item # 商品详情
#    - /api/dis
yt.filter.allowPaths[0]=/api/auth
yt.filter.allowPaths[1]=/api/search
yt.filter.allowPaths[2]=/api/user/register
yt.filter.allowPaths[3]=/api/user/check
yt.filter.allowPaths[4]=/api/user/send
yt.filter.allowPaths[5]=/api/user/query
yt.filter.allowPaths[6]=/api/item
yt.filter.allowPaths[7]=/item
yt.filter.allowPaths[8]=/api/dis
yt.jwt.pubKeyPath=D:/vip/keys/leizhe/id_rsa.pub
yt.jwt.cookieName=YT_TOKEN

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值