-
Spring Boot Thymeleaf URL 链接
@{} 使用@{}表示URL链接,GET请求中使用()表示请求参数。 <link rel="shortcut icon" th:href="@{/favi
2023-08-29,阅读:182,标签:Spring Boot Thymeleaf
-
Spring Boot Thymeleaf 字符串拼接
使用 + 号 将常量字符串使用单引号''括起来,变量使用${}表示,使用+号联结。 <a th:href="'/p/' + ${post.id} + '.
2023-08-28,阅读:144,标签:Spring Boot Thymeleaf
-
Spring Boot Thymeleaf 时间处理类
Java LocalDateTime 类 获取当前时间 <div th:text="${#temporals.createNow()}"></
2023-08-25,阅读:191,标签:Spring Boot Thymeleaf
-
Spring Boot Thymeleaf 获取常量
需求 使用Thymeleaf在HTML中获取Java代码中的常量。 常量 public interface Endpoint { String HOM
2023-08-24,阅读:231,标签:Spring Boot Thymeleaf
-
Spring Boot Thymeleaf 获取 Bean 等容器中的对象
需求 获取@Bean、@Component、@Configuration等Spring自动注入到的容器对象。 ${@} 使用${@}语法,获取容器中的对象。 其
2023-08-23,阅读:199,标签:Spring Boot Thymeleaf
-
Spring Boot Thymeleaf 在 JavaScript 代码中的使用
[[]] 在JavaScript代码中渲染变量,使用[[${var}]],会转义特殊HTML字符。 [()] 在JavaScript代码中渲染变量,使用[(${
2023-08-22,阅读:287,标签:Spring Boot Thymeleaf JavaScript
-
Spring Boot Thymeleaf 3 获取请求的 Uri 路径
需求 由于Thymeleaf3跟随Spring Boot3进行了版本更新,Java扩展包的命名空间由JavaEE改成了JakartaEE。 Thymeleaf3
2023-08-21,阅读:261,标签:Spring Boot Thymeleaf
-
Spring Boot Thymeleaf 循环遍历
th:each ${posts}是从Controller中的Model对象中添加进来的,使用th:each进行遍历,post是临时变量。 <ul th:e
2023-08-18,阅读:262,标签:Spring Boot Thymeleaf
-
Spring Boot Thymeleaf 国际化 i18n
语法 #{} 示例 在th:text中使用#{}引入Resource Bundle中的i18n资源。 <a th:text="#{header_home}
2023-08-17,阅读:271,标签:Spring Boot Thymeleaf i18n
-
Spring Boot Thymeleaf 公共布局
fragment 定义公共模板footer.html,位于resources/templates/portal文件夹下。 <footer class="f
2023-08-16,阅读:207,标签:Spring Boot Thymeleaf
-
Spring Boot Thymeleaf 配置多个模版路径
默认配置 从源码可知,默认会注入一个defaultTemplateResolver对象,我们也可以注入同名对象起到覆盖作用。 @AutoConfiguratio
2023-08-15,阅读:355,标签:Spring Boot Thymeleaf
-
Spring Boot Thymeleaf 设置模板过期时间
方法一 配置缓存 spring: thymeleaf: cache: true 设置缓存过期时间 默认使用LRU算法淘汰缓存,可以在Bean初始化后
2023-08-14,阅读:216,标签:Spring Boot Thymeleaf
-
Spring Boot Thymeleaf 引用外部文件夹中的模版
配置文件 spring: thymeleaf: prefix: file:templates/ 注意 文件夹后的/必须添加,否则会找不到路径,报50
2023-08-11,阅读:225,标签:Spring Boot Thymeleaf
-
Maven 引用 Spring Boot Snapshot 和 Milestone 仓库
需求 为了试验Spring Boot的新功能,需要拉取Spring Boot的Snapshot版本和Milestone版本。 pom.xml 在工程目录的pom
2023-07-20,阅读:460,标签:Spring Boot Maven
-
Spring Boot 3.2 RestClient 同步 HTTP 客户端
HTTP 客户端 Spring 5.0提供了WebClient基于Spring WebFlux的异步HTTP客户端。 Spring 6.1提供了RestClie
2023-07-19,阅读:255,标签:Spring Boot HTTP
-
Spring Boot Callable 异步接口服务端超时后是否会继续执行业务逻辑
Controller 代码 使用了Callable作为返回值,Spring Boot会当作异步接口来处理。 @GetMapping("/timeout") pu
2023-07-18,阅读:209,标签:Spring Boot juc
-
Spring Boot 设置 Controller 处理超时时间
同步接口 对于同步接口,Spring Boot并不支持服务端的超时时间。(即:客户端不中断请求的情况下将无限制等待服务端返回信息) 而server.tomcat
2023-07-17,阅读:998,标签:Spring Boot Tomcat
-
Spring Boot zalando logbook 过滤不打印指定请求
需求 zalando logbook会打印很多prometheus收集监控数据的HTTP请求数据。 如:/actuator/prometheus、/actuat
2023-07-14,阅读:258,标签:Spring Boot
-
Spring Boot Tomcat 报错 The valid characters are defined in RFC 7230 and RFC 3986
错误信息 java.lang.IllegalArgumentException: Invalid character found in the request
2023-07-13,阅读:343,标签:Spring Boot Tomcat
-
Spring Boot OpenFeign 动态切换 Url 报错解决方法
错误信息 No Feign Client for loadBalancing defined. Did you forget to include sprin
2023-07-12,阅读:619,标签:Spring Boot OpenFeign