前提条件:nginx支持ngx_http_slice_module模块 配置文件示例: #location 块的配置: location /asd/ { slice 512k; proxy_cache cache; proxy_cache_key $uri$is_args$args$slice_ra ...
分类:
其他好文 时间:
2020-07-19 00:50:36
阅读次数:
186
一,为什么要使用caffeine做本地缓存? 1,spring boot默认集成的进程内缓存在1.x时代是guava cache 在2.x时代更新成了caffeine, 功能上差别不大,但后者在性能上更胜一筹, 使用caffeine做本地缓存,取数据可以达到微秒的级别, 一次取数据用时经常不足1毫秒 ...
分类:
编程语言 时间:
2020-07-19 00:47:58
阅读次数:
94
官网:https://docs.spring.io/spring/docs/5.2.7.RELEASE/spring-framework-reference/core.html#beans-annotation-config 1、导入约束 2、配置注解支持 <?xml version="1.0" e ...
分类:
编程语言 时间:
2020-07-19 00:44:39
阅读次数:
89
一、环境 1、导入包 maven 2、xml配置文件 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3. ...
分类:
编程语言 时间:
2020-07-19 00:32:25
阅读次数:
87
一般情况下,对来自浏览器的请求的拦截,是利用Filter实现的 而在Spring中,基于Filter这种方式可以实现Bean预处理、后处理。 比如注入FilterRegistrationBean,然后在这个Bean上传递自己继承Filter实现的自定义Filter进入即可。 而Spring MVC也 ...
分类:
编程语言 时间:
2020-07-19 00:31:58
阅读次数:
82
参考文档: 码农翻身-从零开始造Spring 中的《介绍TDD开发方式, 重构的方法》 TDD的流程是: 写一个测试用例->运行:失败->写Just enough的代码,让测试通过->重构代码保持测试通过,然后循环往复。 下面,我们通过一个简单的例子来说明TDD的流程 需求:写一个方法,返回小于给定 ...
分类:
其他好文 时间:
2020-07-18 22:55:27
阅读次数:
86
1、官网 https://docs.spring.io/spring/docs/5.2.7.RELEASE/spring-framework-reference/core.html#beans-dependencies 2、构造器注入(前面有) 3、Set方式注入(重点) A、依赖 : bean对象 ...
分类:
编程语言 时间:
2020-07-18 22:25:29
阅读次数:
84
在使用spring项目接入携程 apollo 的时候,报了一个错误:Cause: [status code: 404] Could not find config for namespace - appId: housing102, cluster: default, namespace: appl ...
分类:
其他好文 时间:
2020-07-18 22:06:51
阅读次数:
150
IOC: 由spring 进行创建、管理、配置 官网:https://docs.spring.io/spring/docs/5.2.7.RELEASE/spring-framework-reference/core.html#beans-child-bean-definitions 一个简单的例子 ...
分类:
编程语言 时间:
2020-07-18 22:02:37
阅读次数:
72
前后端项目分离,跨域请求时,后端的两种配置方式: 1.配置类: package com.helq3.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annot ...
分类:
编程语言 时间:
2020-07-18 21:52:43
阅读次数:
86