Category Archives: 心情随笔

Maven使用shade插件实现包的自动重命名,以解决依赖冲突

最近在写一个hadoop的job,其中依赖了guava,我需要的版本是27.2-jre

然而,不幸的是,Hadoop集群上是2.7.2,其中也有guava版本,11.0.2

更坑的是,guava在16之后有break change,无法向下兼容。

导致不管怎么运行,都会出现:
Error: com.google.common.hash.Funnels.stringFunnel(Ljava/nio/charset/Charset;)Lcom/google/common/hash[......]

继续阅读

Secure Boot时,提示内核签名无效

安装新内核后,若启用了Secure Boot,可能会提示内核签名无效,例如:
error: /boot/vmlinuz-5.3.0-7629-generic has invalid signature
error: you need to load the kernel first
此时有3个方案:

  1. 禁用Secure Boot
  2. 对证书签名,可以参考 https://askubuntu.com/questions/762254/why-do-i-get-required-ke[......]

    继续阅读

转《Spring Bean 初始化之InitializingBean, init-method 和 PostConstruct》

https://segmentfault.com/a/1190000014105687

  1. spring bean的初始化执行顺序:构造方法(依赖注入完成) --> @PostConstruct注解的方法 --> afterPropertiesSet方法 --> init-method指定的方法。具体可以参考例子
  2. afterPropertiesSet通过接口实现方式调用(效率上高一点),@PostConstruct和init-method都是通过反射机制调用

[......]

继续阅读