最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

spring webflux - Spotbugs + Java: EI_EXPOSE_REP2 may expose internal representation by storing an externally mutable object into

programmeradmin0浏览0评论

Small question regarding a Spotbugs finding I am having a hard time fixing.

In this super simple class:

import .springframework.web.reactive.function.client.WebClient;

@Service
public final class MyService {
    
    private final WebClient webClient;
    
    public MyService(final WebClient client) {
        this.webClient = client;
    }

I am getting flagged on the observationRegistry with

may expose internal representation by storing an externally mutable object into MyService.webClient

I tried invoking a possible clone() method on the web client, but no luck.

How do I fix this?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论