Sonar抱怨Spring Boot配置

dmf*_*rey 7 spring spring-boot spring-java-config sonarqube spring-cloud

我有这个类来启动spring-cloud配置服务器.这是一个spring-boot应用程序.

@SpringBootApplication
@EnableConfigServer
@EnableDiscoveryClient
public class ConfigServerApplication {

    public static void main( String[] args ) {

        SpringApplication.run( ConfigServerApplication.class, args );

    }

}
Run Code Online (Sandbox Code Playgroud)

应用程序运行正常,我所有的单元测试都很好.但是,在我们的竹子管道中,它将初始化一个声纳过程来分析代码.我们不断收到这些小警告,表明以下内容:

Utility classes should not have a public constructor
Run Code Online (Sandbox Code Playgroud)

我知道这是一个小问题,但我的任务是从代码中删除这些.

理想情况下,您可以将类标记为final并提供私有构造函数,或者所有搜索都提供解决方案.但是,Spring Configuration类不能成为final,也不能有私有构造函数.

任何想法如何解决这个问题?

spe*_*ibb 5

我担心这不是spring-boot或spring-cloud可以解决的问题.您需要为声纳配置添加例外.

  • 嗨,您可以在问题跟踪系统中添加帖子或问题的链接吗? (2认同)