V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
singleion
V2EX  ›  问与答

springboot 项目的 spring-boot-starter-web 包与 mybatis-spring-boot-starter 是否有冲突?

  •  
  •   singleion · Apr 24, 2018 · 5596 views
    This topic created in 2935 days ago, the information mentioned may be changed or developed.

    原因如下:

    	自己摸索 springboot 与 mybatis 和 thymeleaf 进行整合时,同时引进了 spring-boot-starter-web 包 
    
              mybatis-spring-boot-starter 包和 spring-boot-starter-thymeleaf,启动项目后报出了以下异常
    
    	Caused by:java.lang.NoClassDefFoundError:org/thymeleaf/spring5/view/ThymeleafViewResolve
    	后来把 spring-boot-starter-web 包注释掉,就可以正常启动项目,三者全部整合完成!不知道是什么问题?
    
    4 replies    2018-04-26 15:13:08 +08:00
    alvinbone88
        1
    alvinbone88  
       Apr 24, 2018
    两者没冲突,造成错误的原因是依赖没下载完全,建议删掉 Gradle 或 Maven 的缓存重新下载
    当然也不排除配置文件里存在拼写错误
    singleion
        2
    singleion  
    OP
       Apr 24, 2018
    两个包好像都有 spring-boot-starter
    honeycomb
        3
    honeycomb  
       Apr 24, 2018 via Android
    @singleion
    你的情况比较(实际上就是)像是 maven 没有正确地下载 thymeleaf 的 jar,所以才会报 noclassdef。

    你到 maven 本地库把对应版本的 thymeleaf 的目录删掉,再让 maven update 一下以重新下载

    springboot 设计上就考虑同时引用多个 spring-boot-starter
    jack80342
        4
    jack80342  
       Apr 26, 2018
    最近翻译了最新的 Spring boot 官方文档,https://www.gitbook.com/book/jack80342/spring-boot/details
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1151 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 23:08 · PVG 07:08 · LAX 16:08 · JFK 19:08
    ♥ Do have faith in what you're doing.