Spring Cloud 开发过程中遇到的问题(持续更新)
发布时间
阅读量:
阅读量
记录开发过程中的问题
方便查阅
Spring Cloud
详解Spring Cloud Gateway 限流操作
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
</dependency>
xml
配置:
filters:
- name: RequestRateLimiter
args:
redis-rate-limiter.replenishRate: 10
redis-rate-limiter.burstCapacity: 20
key-resolver: "#{@ipKeyResolver}"
- filter名称必须是RequestRateLimiter
- redis-rate-limiter.replenishRate:允许用户每秒处理多少个请求
- redis-rate-limiter.burstCapacity:令牌桶的容量,允许在一秒钟内完成的最大请求数
- key-resolver:使用SpEL按名称引用bean
Consul 自动取消注册
补充下面的配置,时间自己设置,其他配置省略了。
spring:
cloud:
consul:
discovery:
health-check-critical-timeout: 30s
yml
MyBatis-Plus
自定义查询
正常情况下,我们需要对表进行自定义查询,但是怎么传递查询的(想要使用plus的方法)
Mapper文件
@Select("select id,name,type,note,create_time from my_dict ${ew.customSqlSegment}")
IPage<MyDict> customPage(IPage<MyDict> page,
@Param(Constants.WRAPPER) Wrapper<MyDict> queryWrapper);
java
注意点:
- 添加
${ew.customSqlSegment} - 添加
@Param(Constants.WRAPPER) Wrapper<MyDict> queryWrapper
MySQL查询某列字段超长加省略号
SELECT
(
CASE WHEN LENGTH(查询的字段名)>最大字符个数
THEN CONCAT(SUBSTRING(查询的字段名,1,最大字符长度),'...')
ELSE 查询的字段名 END
) AS 别名
FROM 查询的表
sql
Vue.js
this.$router.push的使用方法
query方式,相当于get
跳转
this.$router.push({path:'path',query:{id:id})
js
获取参数
this.$route.query.id
js
params方式,body
this.$router.push({path:'path',params:{id:id})
this.$router.push({name:'name',params:{id:id})
js
获取参数
this.$route.params.id
js
怎么使用延时函数
setTimeout(() =>{
console.log(1)
},1000);
js
全部评论 (0)
还没有任何评论哟~
