代码之家  ›  专栏  ›  技术社区  ›  gabriel119435

使用Spring Zuul和Spring初始值设定项进行正确的依赖关系管理

  •  0
  • gabriel119435  · 技术社区  · 6 年前

    我想实现一些基于hello world的Spring Zuul项目 Baeldung this pt-br blog

    因为第一个使用了这个非弹簧工件

    <groupId>com.baeldung.spring.cloud</groupId>
    <artifactId>spring-cloud</artifactId>
    

    作为父级和第二级使用 this deprecated artifact dependencyManagement ,我决定使用 spring initalizr 只是将Zuul添加到我的依赖项中。但当我运行它时,会出现以下异常:

    Caused by: java.lang.ClassNotFoundException: com.netflix.zuul.monitoring.CounterFactory
    

    我在主课上使用了以下注释:

    @SpringBootApplication
    @EnableZuulProxy
    @EnableDiscoveryClient
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   gabriel119435    6 年前

    因为我已经试着删除了 .m2 文件夹,但这不起作用,我想我的下载没有再次成功完成。但是我的错误变成了

    Caused by: java.lang.ClassNotFoundException: com.netflix.zuul.ZuulFilter
    

    Caused by: java.util.zip.ZipException: invalid block type
    

    此错误通常是由无效的 .m2

    删除后 everything .m2 上面写着“zuul”,包括 com/netflix/zuul mvn clean package -U 有了maven 3.5.4,我终于成功地启动了我的应用程序。