zoukankan      html  css  js  c++  java
  • RestTemplateConfig写法,用于配置Template引擎模板

    代码:

     1 import org.springframework.context.annotation.Bean;
     2 import org.springframework.context.annotation.Configuration;
     3 import org.springframework.http.client.ClientHttpRequestFactory;
     4 import org.springframework.http.client.SimpleClientHttpRequestFactory;
     5 import org.springframework.web.client.RestTemplate;
     6 @Configuration
     7 public class RestTemplateConfig {
     8     @Bean
     9     public RestTemplate restTemplate(ClientHttpRequestFactory factory){
    10         return new RestTemplate(factory);
    11     }
    12     @Bean
    13     public ClientHttpRequestFactory simpleClientHttpRequestFactory(){
    14         SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
    15         factory.setReadTimeout(5000);
    16         factory.setConnectTimeout(5000);
    17         return factory;
    18     }
    19 }

    yml配置:

    1 #禁用模板引擎的缓存
    2 thymeleaf:
    3   cache: false
    4 resources:
    5   static-locations: classpath:/static/
    6 mvc:
    7   data-format: yyyy-mm-dd HH:mm:ss

    把html放在templates中:

  • 相关阅读:
    BZOJ1000 A+B Problem
    网络最大流
    树形结构
    BZOJ2521 最小生成树 最小割
    HDU5266 LCA 树链剖分LCA 线段树
    BZOJ3991 寻宝游戏 LCA 虚树 SET
    深度优先搜索DFS
    斯特林数
    Noip2017 普及 T3 Chess
    键盘自动机
  • 原文地址:https://www.cnblogs.com/wangquanyi/p/11329022.html
Copyright © 2011-2022 走看看