From 91bcc1e09b22666dd09ba58ffde6881f42c680a3 Mon Sep 17 00:00:00 2001 From: horaoen Date: Thu, 31 Oct 2024 18:54:38 +0800 Subject: [PATCH] update --- content/posts/CLI.md | 6 +++++ content/posts/dm-migrate.md | 14 ++++++++++ content/posts/spring-boot-usage.md | 11 ++++++++ content/posts/spring.md | 41 ++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 content/posts/CLI.md create mode 100644 content/posts/dm-migrate.md create mode 100644 content/posts/spring-boot-usage.md create mode 100644 content/posts/spring.md diff --git a/content/posts/CLI.md b/content/posts/CLI.md new file mode 100644 index 0000000..5c3095c --- /dev/null +++ b/content/posts/CLI.md @@ -0,0 +1,6 @@ ++++ +title = "CLI" +date = "2024-10-15" ++++ + +1. 网络带宽测试工具 speedtest-cli diff --git a/content/posts/dm-migrate.md b/content/posts/dm-migrate.md new file mode 100644 index 0000000..5596d46 --- /dev/null +++ b/content/posts/dm-migrate.md @@ -0,0 +1,14 @@ ++++ +title = "达梦数据库迁移" +date = "2024-10-28" ++++ + +# 环境 +1. 客户端:macos使用dbeaver, IDEA: 使用mysql连接修改驱动使用达梦数据库连接驱动 +# 函数 +1. str_to_date => to_date(date1, 'YYYY-MM-DD HH24:MI:SS') +2. group_concat => wm_concat / listagg +3. date_sub => add_days / add_months +4. current_time => current_date() / sysdate() / curdate() +5. date(var) => trunc(var) +6. convert => cast \ No newline at end of file diff --git a/content/posts/spring-boot-usage.md b/content/posts/spring-boot-usage.md new file mode 100644 index 0000000..4e7e56a --- /dev/null +++ b/content/posts/spring-boot-usage.md @@ -0,0 +1,11 @@ ++++ +title = "springboot usage" +date = "2024-10-30" ++++ + +1. jdbcTemplate配置sql日志打印 +```yaml +logging: + level: + org.springframework.jdbc.core.JdbcTemplate: DEBUG +``` diff --git a/content/posts/spring.md b/content/posts/spring.md new file mode 100644 index 0000000..33f5e71 --- /dev/null +++ b/content/posts/spring.md @@ -0,0 +1,41 @@ ++++ +title = "spring" +date = "2024-10-15" ++++ + +# Bean 缓存 + +```java +@Nullable +protected Object getSingleton(String beanName, boolean allowEarlyReference) { + // 查询一级缓存 + Object singletonObject = this.singletonObjects.get(beanName); + // 如果一级缓存不存在且当前 bean 正在创建 + if (singletonObject == null && isSingletonCurrentlyInCreation(beanName)) { + // 查询二级缓存 + singletonObject = this.earlySingletonObjects.get(beanName); + // 如果二级缓存不存在且允许提前引用 + if (singletonObject == null && allowEarlyReference) { + synchronized (this.singletonObjects) { + // Consistent creation of early reference within full singleton lock + // 一级缓存重新获取 + singletonObject = this.singletonObjects.get(beanName); + if (singletonObject == null) { + // 二级缓存重新获取 + singletonObject = this.earlySingletonObjects.get(beanName); + if (singletonObject == null) { + // 三级缓存获取 + ObjectFactory singletonFactory = this.singletonFactories.get(beanName); + if (singletonFactory != null) { + singletonObject = singletonFactory.getObject(); + this.earlySingletonObjects.put(beanName, singletonObject); + this.singletonFactories.remove(beanName); + } + } + } + } + } + } + return singletonObject; +} +``` \ No newline at end of file