Daizc
count.articles52
count.tags25
count.categories3
Kubernetes安装笔记

Kubernetes安装笔记

本篇仅纯笔记,记录安装踩坑和一些细节,本次安装也仅仅只安装了3台机器,组建最小集群。

Angular初学排坑日记(二) windows软链接惨案

Angular初学排坑日记(二) windows软链接惨案

上文讲到已经成功创建了Angular项目,现在总得跑下DEMO来试试水吧,于是打开webstorm导入项目,单击播放键。好家伙,新错误来了。

1
2
3
4
5
6
7
8
9
10
11
12
13
D:\Users\Link\WebstormProjects\angularDemo\src\polyfills.ts - Error: Module build failed (from D:\Users\Link\WebstormPro
ojects\angularDemo\node_modules\@ngtools\webpack\src\ivy\index.js):
Error: D:\Users\Link\WebstormProjects\angularDemo\src\polyfills.ts is missing from the TypeScript compilation. Please ma
ake sure it is in your tsconfig via the 'files' or 'include' property.
at D:\Users\Link\WebstormProjects\angularDemo\node_modules\@ngtools\webpack\src\ivy\loader.js:60:26



** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **


× Failed to compile.
√ Browser application bundle generation complete.

编译失败,但浏览器启动成功。弹出一个明晃晃的Cannot GET /

Angular初学排坑日记(一)cnpm安装惨案

Angular初学排坑日记(一)cnpm安装惨案

最近做中间件开发,涉及到不少的项目改造,发现有不少中间件的前端都是拿Angular写的,自己看Angular看不太懂,前端同事都是vue玩家,
也不太玩得转这玩意儿,但是改不动中间件的前端的确蛮吃亏,再加上之前群里朋友煽风点火,于是有了折腾下Angular的念头。
正好拿了台新电脑来玩,准备整个Angular玩玩,于是直接拿scoop配环境配好了node环境和npm。

[DEBUG日记]Swagger扫不到类-Jdk代理导致的反射类型故障

[DEBUG日记]Swagger扫不到类-Jdk代理导致的反射类型故障

先说结论

jdk代理的问题,换用cglib代理就好了。随便找个配置类,加上 @EnableAspectJAutoProxy注解即可解决。

PDF疑难杂症

PDF疑难杂症

PDF是一个由Adobe编写现由国际标准化组织 (ISO) 维护的一个开放式标准,PDF 文档可以包含链接和按钮、表单域、音频、视频和业务逻辑。这种文件可进行电子签名,因此政府机构大量在用,但是仍然是个煞笔格式。

解决由https转发导致的SpringCloudGateway转发异常

解决由https转发导致的SpringCloudGateway转发异常

错误日志如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
2021-07-27 15:51:31.302  WARN [TID:TID-1419928421240946688][PID:1][or-http-epoll-2] r.netty.http.client.HttpClientConnect    [299]: [id: 0xe9859259, L:/10.42.8.227:41228 ! R:10.42.4.120/10.42.4.120:8080] The connection observed an error

io.netty.handler.codec.DecoderException: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 485454502f312e31203430302042616420526571756573740d0a436f6e74656e742d4c656e6774683a20300d0a436f6e6e656374696f6e3a20636c6f73650d0a0d0a
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:477)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795)
at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480)
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Caused by: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 485454502f312e31203430302042616420526571756573740d0a436f6e74656e742d4c656e6774683a20300d0a436f6e6e656374696f6e3a20636c6f73650d0a0d0a
at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1213)
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ com.alibaba.csp.sentinel.adapter.spring.webflux.SentinelWebFluxFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ HTTP GET "/某个service/v2/api-docs" [ExceptionHandlingWebHandler]
Stack trace:
at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1213)
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1280)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:507)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:446)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795)
at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480)
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
定制Jackson注解实现字段脱敏

定制Jackson注解实现字段脱敏

功能

在保证jackson原注解不失效的前提下,通过自定义注解对POJO中部分指定的字段进行自定义处理

完成样式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
public class Test {

public static void main(String[] args) throws JsonProcessingException {

ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setAnnotationIntrospector(new EnhanceJacksonAnnotationIntrospector());
A a = new A();
a.setAge(10);
a.setName("ASDASDASD");
a.setRemark("REMARK!");
a.setMobile("17600000000");
System.out.println(objectMapper.writeValueAsString(a));
}


@Data
static class A {

private String name;

private Integer age;

private String remark;

@JsonMask(a = "",b = "",c = "")
private String mobile;
}
}

运行结果

1
{"name":"ASDASDASD","age":10,"remark":"REMARK!","mobile":"1760****000"}
[ESP8266]02_Lua基础

[ESP8266]02_Lua基础

[ESP8266]01_刷写测试AT固件

[ESP8266]01_刷写测试AT固件

改造Spring-data-redis 优雅设置过期时间

改造Spring-data-redis 优雅设置过期时间

Spring-data-redis是一个比较优雅的缓存解决方案,只需要在对应的方法上打上注解就可以便捷的将数据放入redis。

但Spring-data-redis中配置TTL只能按照cacheName的维度进行配置,并不能精确到具体的接口上。

比如以下需求就不能优雅的实现:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
public interface CacheDemo{

// 这个接口只缓存30min
@Cacheable(value = "user", keyGenerator = "xxxx")
List<User> listByQuery(UserQuery query);

// 这个接口只缓存1min
@Cacheable(value = "user", keyGenerator = "xxxx")
List<User> takeUserFromObj(Object obj);

// 这个接口缓存180min
@Cacheable(value = "user", keyGenerator = "xxxx")
List<User> getByUserId(String userId);
}

这篇文章就将以定制Cache具体实现类的方式优雅的实现这个功能.