`
zweichxu
  • 浏览: 131958 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论
文章列表
Spring cloud gateway 升级到Hoxton.SR12之后,在Token验证的filter里,通过openfeign调用User Auth服务时,碰到如下错误:   java.lang.IllegalStateException: block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-nio-3 at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSi ...
     2018年开始做spring cloud微服务,选定版本是Finchley.RC2,时至今日,spring cloud版本从Finchley经历了GreenWich、Hoxton、2020.0.x、2021.0.x的变化,每一个版本的变化,使用的组件都有大的改变。Spring Cloud netflix中的zuul, ribbon, hystrix都基本上算是废了。      zuul改用spring cloud gateway, Hystrix 直接改用Spring Cloud Circuit Breaker + Resilience4J,Ribbon改用 Spring Clou ...
最近手贱,把一个项目的springboot版本由2.3升级到了2.4.1,结果开发时跨域失效了。查看接口日志,报错: java.lang.IllegalArgumentException: When allowCredentials is true, allowedOrigins cannot contain the special value "*"since that cannot be set on the "Access-Control-Allow-Origin" response header. To allow credentials t ...
假设我有一个业务,根据一定规则轮流分配给两个不同的平台来完成。我定义任务数据发送接口,两家平台各自实现接口接收我发送的任务数据。如何根据两家平台提供的url动态创建feign客户端? 1.定义数据发送接口: @FeignClient(name = "TaskSendClient") public interface ITaskSendClient{ @PostMapping(value="sendTask",consumes= MediaType.APPLICATION_JSON_UTF8_VALUE) SendTaskResp sen ...
summernote富文本框提供了插入图片功能,对插入的图片的编辑,提供了“缩放至100%”,“缩放至50%”,“缩放至25%”以及原始大小四个按钮,想要增加“缩放至75%”的功能。本文记录如何增加“缩放至75%”功能(本文将“缩放至75%”按钮命名为resizePrecent75)。 要增加“缩放至75%”功能,需要修改summernote.js(或者summernote.min.js)及summernote-zh-CN.js文件。 1.修改summernote-zh-CN.js文件,在image结构体中增加 resizePrecent75 的定义: image: { ...
summernote富文本框提供了插入图片功能,对插入的图片的编辑,提供了“靠左浮动”,“靠右浮动”,“取消浮动”三个按钮,想要增加“居中对齐”功能。本文记录如何增加“居中对齐”功能。 要增加居中对齐功能,需要修改summernote.js(或者summernote.min.js)及summernote-zh-CN.js文件。 1.修改summernote-zh-CN.js文件,在image结构体中增加    floatCenter: '水平居中' 的定义: image: { image: '图片', insert: '插入图片', ...
    spring boot应用,通常我们在进行数据管理时,只操作一个数据源的表,需要开启事务管理,只需要在服务启动类增加@EnableTransactionManagement注解,在需要事务控制的方法增加@Transactional注解即可。 即便是多数据源切换情况下,在需要事务控制的方法只操作一个数据源,也可以满足。     但如果在需要事务控制的方法里,同时操作多个数据源的表,这时候仅仅是上述两个注解,不能保证事务的一致性(这是分布式事务的范畴)。比如,我要往A数据源的表插如一条记录,同时更新B数据源的表,并且需要进行事务控制,该怎么处理?     首先我们要理解,什么是分布 ...
spring boot内嵌容器默认为tomcat,想要换成undertow,非常容易,只需修改spring-boot-starter-web依赖,移除tomcat的依赖: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web ...
环境:spring cloud Finchley.RC2,spring boot 2.0.2.RELEASE,eureka 1.9.0 .properties文件增加如下配置: eureka.instance.instance-id=${spring.cloud.client.ip-address}:${server.port} eureka.instance.prefer-ip-address=true  .yml文件则增加以下配置: eureka: instance: instance-id: ${spring.cloud.client.ip-address}: ...
(1)eureka.client.registry-fetch-interval-seconds 表示eureka client间隔多久去拉取服务注册信息,默认为30秒,对于api-gateway,如果要迅速获取服务注册状态,可以缩小该值,比如5秒 (2)eureka.instance.lease-expiration-duration-in-seconds leaseExpirationDurationInSeconds,表示eureka server至上一次收到client的心跳之后,等待下一次心跳的超时时间,在这个时间内若没收到下一次心跳,则将移除该instance。 默 ...
环境:spring cloud Finchley.RC2,spring boot 2.0.2.RELEASE,eureka 1.9.0   1. pom 文件中引入依赖      添加spring-security支持:  <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency>   2 ...
 开发中会遇到要求对http传输的数据进行加密传输,我们可以重写spring mvc的MappingJackson2HttpMessageConverter类,实现对加密解密的支持。代码如下: package com.hzwei.spring.messageconvert.ext; import java.io.*; import java.lang.reflect.Type; import org.springframework.http.*; import org.springframework.http.converter*; import org.springfra ...
    本篇主要记录如何在spring boot开发中,集成redis操作。按照spring boot的惯例,开发一个redis starter模块,借此记录如何开发一个spring boot starter模块。      在java ide中新建maven工程,按照spring boot starter约定的规则命名为ecode-redis-spring-boot-starter,并引入依赖: <dependencies> <dependency> <groupId>org.springframework ...
如果Mapper接口中的方法如果只有一个参数,则xml动态sql中可以直接引用参数名,如果有多个参数,保险做法是使用@Param注解设置参数别名,这样可以在xml动态sql中使用参数别名。 如:List searchSometh(@Param("parama") String parama, @Param("paramb") List<String> paramb); <select id="searchSometh" ..> select * from some_table <trim pre ...
直接在application.properties配置。参见官网说明(Part X. Appendices)   #Network address to which the server should bind to. server.address=   #If response compression is enabled(tomcat: compression="on"). server.compression.enabled=true   #List of user-agents to exclude from compression(tomcat: ...
Global site tag (gtag.js) - Google Analytics