广告
返回顶部
首页 > 资讯 > 精选 >freemarker如何在Spring Boot项目中使用
  • 867
分享到

freemarker如何在Spring Boot项目中使用

springbootfreemarker 2023-05-31 01:05:02 867人浏览 安东尼
摘要

今天就跟大家聊聊有关freemarker如何在Spring Boot项目中使用,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。(1) freemarker介绍;FreeMarker是一

今天就跟大家聊聊有关freemarker如何在Spring Boot项目中使用,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

(1) freemarker介绍;

FreeMarker是一款模板引擎: 即一种基于模板和要改变的数据,   并用来生成输出文本(html网页、电子邮件、配置文件、源代码等)的通用工具。       它不是面向最终用户的,而是一个Java类库,是一款程序员可以嵌入他们所开发产品的组件。

(2) 新建spring-boot-freeMarker工程;

我们新建一个Maven工程,取名为:spring-boot-freemarker

(3) 在pom.xml引入相关依赖;

这里使用freeMarker需要引入相关依赖包:spring-boot-starter-freemarker,

<project xmlns="Http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">  <modelVersion>4.0.0</modelVersion>    <groupId>com.kfit</groupId>  <artifactId>spring-boot-velocity</artifactId>  <version>0.0.1-SNAPSHOT</version>  <packaging>jar</packaging>    <name>spring-boot-velocity</name>  <url>http://maven.apache.org</url>    <properties>   <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>    <!-- jdk版本号,angel在这里使用1.8,大家修改为大家本地配置的jdk版本号即可 -->   <java.version>1.8</java.version>  </properties>     <!--     spring boot 父节点依赖,     引入这个之后相关的引入就不需要添加version配置,     spring boot会自动选择最合适的版本进行添加。    -->   <parent>     <groupId>org.springframework.boot</groupId>     <artifactId>spring-boot-starter-parent</artifactId>     <version>1.4.1.RELEASE</version><!-- 1.4.1.RELEASE , 1.3.3.RELEASE-->   </parent>    <dependencies>   <dependency>    <groupId>junit</groupId>    <artifactId>junit</artifactId>    <scope>test</scope>   </dependency>        <!-- spring boot WEB支持:mvc,aop... -->   <dependency>     <groupId>org.springframework.boot</groupId>     <artifactId>spring-boot-starter-web</artifactId>   </dependency>      <!-- 引入freeMarker的依赖包. -->   <dependency>       <groupId>org.springframework.boot</groupId>      <artifactId>spring-boot-starter-freemarker</artifactId>   </dependency>     </dependencies> </project>  

--结束END--

本文标题: freemarker如何在Spring Boot项目中使用

本文链接: https://www.lsjlt.com/news/222718.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作