springboot 的一些坑,持续更新。。。

2018-10-17  本文已影响103人  Helen_Cat

1.比如之前认证的那个破玩意 ,取消不掉的问题
需要这样
其实 这个时候只能这样了
在你的springboot 的启动类 加上注解

@EnableAutoConfiguration(exclude = { org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
})

  1. 另外是使用RestTemplate 请求外部接口,报
    springboot esulted in 413 (Request Entity Too Large: head); invoking error handler
    这个异常真他娘诡异,后来查看日志,自己组装的httpEntity没有问题,有问题的是他把一些 http header 之前请求的buffer都添加到了新的 header中,造成header巨大无比,所以,需要把 buffer cache 拿掉
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestTemplate;
   SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
        factory.setBufferRequestBody(false);
        RestTemplate reqtemplate = new RestTemplate(factory);
        String strbody=reqtemplate.exchange(url,HttpMethod.POST,jsonentity,String.class).getBody();
上一篇 下一篇

猜你喜欢

热点阅读