zoukankan      html  css  js  c++  java
  • 【转】解决高版本springboot对Velocity不支持

    https://blog.csdn.net/sinat_31270499/article/details/82283880

    最近在做关于Spring Boot开发的项目,因为项目中要用到Velocity的模板引擎,而现在新版本在官网上已经不支持Velocity了。

    不能加入velocity相关的依赖

    在http://velocity.apache.org/download.cgi#engine上看到有相关的依赖jar包和配置信息,首先下载jar包:

    下载的是:

    engine-core velocity-engine-core-2.0.jar
    下下来之后是这样一个东西:

    然后在Idea中导入jar包,点击file中的project structure:

    然后选择modules中的dependencies,点击那个+号,找到你刚刚下载好的文件,就可以导入外部的jar包了。

    因为当初官网初始化Spring的时候没有选择模板引擎,现在需要自己手动添加:

    找到pom.xml文件,在<dependencies></dependencies>中间加入:

    文本格式:

    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-velocity</artifactId>
    </dependency>

    <dependency>
    <groupId>org.apache.velocity</groupId>
    <artifactId>velocity-engine-core</artifactId>
    <version>2.0</version>
    </dependency>

    <dependency>
    <groupId>org.apache.velocity</groupId>
    <artifactId>velocity-tools</artifactId>
    <version>2.0</version>
    </dependency>
    将Spring Boot的版本从Spring Boot 1.5.15改成1.4.0,这个版本支持Velocity。

    改好后,保存,运行,如果你在运行之后能看到这样的一行,说明你已经成功的导入了velocity的依赖

    然后就可以在网页中打开自己写的.vm模板文件了。

  • 相关阅读:
    spring boot 将对象转换为json返回
    Linux 文件创建、插入、替换
    Prometheus + AlertManager 邮件报警
    Prometheus + Grafana 监控 Redis
    虚拟机 vs 容器
    jira,Confluence 的JVM内存优化
    内网MySQL YUM源记录
    atlassian-jira部署文档
    桥接
    http验证
  • 原文地址:https://www.cnblogs.com/exmyth/p/10933881.html
Copyright © 2011-2022 走看看