美文网首页
SpringBoot踩坑实录(updating)

SpringBoot踩坑实录(updating)

作者: 李2牛 | 来源:发表于2018-07-09 16:43 被阅读0次
  1. 无法解析映射到指定的 thymeleaf 模板.

Spring Boot 默认依赖的是低版本的Thymeleaf,低版本的Thymeleaf不能解析HTML5格式的HTML代码,而是把HTML当成XML解析,所有标签必须闭合!
在pom.xml中的properties标签中加入如下代码

<!-- 覆盖thymeleaf版本依赖 -->
<thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
<thymeleaf-extras-java8time.version>3.0.0.RELEASE</thymeleaf-extras-java8time.version>
<thymeleaf-layout-dialect.version>2.0.5</thymeleaf-layout-dialect.version>      

完美解决问题

  1. 创建SpringBoot工程最好使用模板,避免必要的依赖丢失导致工程无法启动。
    SpringBoot的一个基本依赖为
<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </dependency>
    </dependencies>

spring-boot-starter-web :集成了Tomcat相关配置,Spring MVC,会自动配置一个web项目的逻辑(不要忘记,笔者踩过坑)

image.png

spring-boot-starter-tomcat : 内嵌的 Tomcat
spring-boot-starter-thymeleaf : SpringBoot默认的模板引擎

  1. windows下的logback路径引用问题
    日志生成路径
    这里不能使用windows路径的\ ,会被自动忽略,必须使用unix的路径表示方法,属性值将会生成对应的工程所在盘符下的目录结构。
    官网说明
    官网也语焉不详,只是给出了 unix风格路径,使用时注意即可。

相关文章

  • SpringBoot踩坑实录(updating)

    无法解析映射到指定的 thymeleaf 模板. Spring Boot 默认依赖的是低版本的Thymeleaf,...

  • springboot 踩坑 This application h

    springboot 初学者踩坑记录 This application has no explicit mappi...

  • Vue踩坑实录(二)

    在上一篇中说了一下踩过的前三个坑,剩下的坑就在这篇中全部搞定吧。Vue踩坑实录(一) Vue-cli .js?.V...

  • springboot 2 下 java 代码 动态编译 动态加载

    先放出代码,再说有几个坑的地方: 调用的时候 sample 如下: 踩坑的地方如下: 启动 springboot ...

  • fastlane 踩坑实录

    这个世界是懒人创造的。 人懒了就会发明各种各样的工具,或者寻找各种各样能够给自己偷懒机会的工具,当然我还停留在使用...

  • Mongo踩坑实录

    1.更新数据时,js脚本中没有指定数据类型,int数据被更新成了double,导致线上问题。 原因,js是弱类型,...

  • gitattribute踩坑实录

    工欲善其事,必先利其器。 前一阵子,公司的版本控制从svn迁移到了git,不得不说,git确实比svn要强大好多,...

  • Weex踩坑实录

    1.新组件无法与配合使用。目前遇到的情况主要是loading没法正常...

  • # Flutter 踩坑实录

    [TOC] Another exception was thrown: A dismissed Dismissib...

  • [php]踩坑实录

    1、strpos()函数的返回值false与0问题 strpos函数定义:int strpos ( string ...

网友评论

      本文标题:SpringBoot踩坑实录(updating)

      本文链接:https://www.haomeiwen.com/subject/gdgkyftx.html