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