springboot中如何整合freemarker
发表于:2025-11-16 作者:千家信息网编辑
千家信息网最后更新 2025年11月16日,这篇文章主要介绍"springboot中如何整合freemarker"的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇"springboot中如何整合freemar
千家信息网最后更新 2025年11月16日springboot中如何整合freemarker
姓名:${stuMap['stu1'].name}年龄: ${stuMap.stu1.age}<#list stuMap?keys as k> 姓名: ${stuMap[k].name} 年龄: ${stuMap[k].age}#list>${stuMap???c}//判断是否存在,和使用 ?c 输出字符串${students???c}${(mozq.bank.address)!'中国建设银行'}//默认值方式处理空值${students?size}//集合大小<#assign text="{'bank':'中国农业银行', 'address':'北大街'}"><#assign data=text?eval>开户行: ${data.bank} 地址: ${data.address}${123456123?c}//不显示逗号分隔${123456123}//默认显示逗号分隔
这篇文章主要介绍"springboot中如何整合freemarker"的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇"springboot中如何整合freemarker"文章能帮助大家解决问题。
依赖
org.springframework.boot spring-boot-starter-parent 2.1.6.RELEASE org.springframework.boot spring-boot-starter-freemarker org.projectlombok lombok com.squareup.okhttp3 okhttp 3.9.1 commons-io commons-io 2.6 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test
application.yml
application 参数路径
server: port: 8001spring: application: name: test-freemarker freemarker: cache: false settings: template_update_delay: 0 template-loader-path: classpath:/templates/
启动类
@SpringBootApplicationpublic class FreemarkerApplication { public static void main(String[] args) { SpringApplication.run(FreemarkerApplication.class, args); } @Bean public RestTemplate restTemplate(){ return new RestTemplate(new OkHttp3ClientHttpRequestFactory()); }}模板文件
| 序号 | 姓名 | 年龄 | 金钱 | 出生日期 |
| ${stu_index} | #if> >${stu.name} | #if>>${stu.age} | ${stu.money} | ${stu.birthday?date},${stu.birthday?time},${stu.birthday?string("yyyy年MM月dd日")} |
Title
Controller
package com.mozq.springboot.freemarker.controller;import com.mozq.springboot.freemarker.model.Student;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.http.ResponseEntity;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.client.RestTemplate;import java.util.*;@Controller //注意不要使用 @RestController@RequestMapping("/freemarker")public class FreeMarkerController { @Autowired private RestTemplate restTemplate; @RequestMapping("/banner") public String banner(Map map){ String dataUrl = "http://localhost:31001/cms/config/getmodel/5a791725dd573c3574ee333f"; ResponseEntity 关于"springboot中如何整合freemarker"的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识,可以关注行业资讯频道,小编每天都会为大家更新不同的知识点。
整合
姓名
年龄
模板
知识
行业
逗号
不同
实用
位置
内容
参数
地址
大小
字符
字符串
实用性
实际
序号
开户行
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
常州应用软件开发服务
网络安全可用性的例子
滦南信息网络技术质量保证
哪个服务器部落多
青浦区本地网络技术代理价钱
杭州安卓软件开发工程师
dbeaver拷贝数据库
网络安全第一时代是
剑灵服务器开发时间表
佛山信息软件开发常见问题
数据库技术心得
四川北斗时钟同步服务器虚拟主机
团区委网络安全周先进集体
英文版sql2000数据库备份
延庆区综合网络技术服务品质保障
数据库系统基础第六版
mysql数据库删除库语句
网络安全网站是什么
大数据库需要哪些技术
华为软件开发过程文档
怎么看数据库环境
郴州学it软件开发工资多少
福建软件开发定制价格
广电网络安全播出例会制度
三星软件开发acm算法题
上海常用软件开发参考价格
天津网络安全工程师培训
数据库原理与应用多表查询
云南网络技术招聘
温州银行软件开发笔试