From 6451e6ea0b8ae7953a8fd7b76bcf5e13dd2868f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E5=89=91=E9=91=AB?= <1064730540@qq.com>
Date: Fri, 14 Oct 2022 19:24:16 +0800
Subject: [PATCH] feat: add apollo spring-boot 1.5.x example
---
.../pom.xml | 86 +++++++++++++++++++
...gApolloSpringBoot15ExampleApplication.java | 31 +++++++
.../src/main/resources/bootstrap.properties | 63 ++++++++++++++
hippo4j-example/pom.xml | 1 +
4 files changed, 181 insertions(+)
create mode 100644 hippo4j-example/hippo4j-config-apollo-spring-boot-1.5-starter-example/pom.xml
create mode 100644 hippo4j-example/hippo4j-config-apollo-spring-boot-1.5-starter-example/src/main/java/cn/hippo4j/example/config/apollo/ConfigApolloSpringBoot15ExampleApplication.java
create mode 100644 hippo4j-example/hippo4j-config-apollo-spring-boot-1.5-starter-example/src/main/resources/bootstrap.properties
diff --git a/hippo4j-example/hippo4j-config-apollo-spring-boot-1.5-starter-example/pom.xml b/hippo4j-example/hippo4j-config-apollo-spring-boot-1.5-starter-example/pom.xml
new file mode 100644
index 00000000..0fe053a1
--- /dev/null
+++ b/hippo4j-example/hippo4j-config-apollo-spring-boot-1.5-starter-example/pom.xml
@@ -0,0 +1,86 @@
+
+
+ 4.0.0
+
+ cn.hippo4j
+ hippo4j-example
+ ${revision}
+
+ hippo4j-config-apollo-spring-boot-1.5-starter-example
+
+
+ true
+ 1.5.22.RELEASE
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ cn.hippo4j
+ hippo4j-example-core
+ ${revision}
+
+
+
+
+ cn.hippo4j
+ hippo4j-config-spring-boot-1.5-starter
+ ${revision}
+
+
+
+ com.ctrip.framework.apollo
+ apollo-client
+ ${apollo.version}
+
+
+
+ org.slf4j
+ slf4j-api
+ 1.7.21
+
+
+
+ org.springframework.cloud
+ spring-cloud-context
+ 1.3.6.RELEASE
+
+
+
+ io.micrometer
+ micrometer-registry-prometheus
+ 1.1.3
+
+
+ io.micrometer
+ micrometer-spring-legacy
+ 1.1.3
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
diff --git a/hippo4j-example/hippo4j-config-apollo-spring-boot-1.5-starter-example/src/main/java/cn/hippo4j/example/config/apollo/ConfigApolloSpringBoot15ExampleApplication.java b/hippo4j-example/hippo4j-config-apollo-spring-boot-1.5-starter-example/src/main/java/cn/hippo4j/example/config/apollo/ConfigApolloSpringBoot15ExampleApplication.java
new file mode 100644
index 00000000..801bb840
--- /dev/null
+++ b/hippo4j-example/hippo4j-config-apollo-spring-boot-1.5-starter-example/src/main/java/cn/hippo4j/example/config/apollo/ConfigApolloSpringBoot15ExampleApplication.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.hippo4j.example.config.apollo;
+
+import cn.hippo4j.core.enable.EnableDynamicThreadPool;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@EnableDynamicThreadPool
+@SpringBootApplication(scanBasePackages = "cn.hippo4j.example.core")
+public class ConfigApolloSpringBoot15ExampleApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(ConfigApolloSpringBoot15ExampleApplication.class, args);
+ }
+}
diff --git a/hippo4j-example/hippo4j-config-apollo-spring-boot-1.5-starter-example/src/main/resources/bootstrap.properties b/hippo4j-example/hippo4j-config-apollo-spring-boot-1.5-starter-example/src/main/resources/bootstrap.properties
new file mode 100644
index 00000000..cb44a4f1
--- /dev/null
+++ b/hippo4j-example/hippo4j-config-apollo-spring-boot-1.5-starter-example/src/main/resources/bootstrap.properties
@@ -0,0 +1,63 @@
+# Configuration reference: https://hippo4j.cn/pages/2f674h
+server.port=8091
+server.servlet.context-path=/example
+
+app.id=dynamic-threadpool-example
+apollo.meta=http://127.0.0.1:8080
+apollo.autoUpdateInjectedSpringProperties=true
+apollo.bootstrap.enabled=true
+apollo.bootstrap.namespaces=application
+apollo.bootstrap.eagerLoad.enabled=true
+
+spring.profiles.active=dev
+spring.application.name=dynamic-threadpool-example
+
+management.metrics.export.prometheus.enabled=true
+management.server.port=29998
+management.endpoints.web.exposure.include=*
+
+spring.dynamic.thread-pool.enable=true
+spring.dynamic.thread-pool.banner=true
+spring.dynamic.thread-pool.check-state-interval=3
+
+spring.dynamic.thread-pool.notify-platforms[0].platform=WECHAT
+spring.dynamic.thread-pool.notify-platforms[0].secret-key=ac0426a5-c712-474c-9bff-72b8b8f5caff
+spring.dynamic.thread-pool.notify-platforms[1].platform=DING
+spring.dynamic.thread-pool.notify-platforms[1].secret-key=56417ebba6a27ca352f0de77a2ae9da66d01f39610b5ee8a6033c60ef9071c55
+spring.dynamic.thread-pool.notify-platforms[2].platform=LARK
+spring.dynamic.thread-pool.notify-platforms[2].secret-key=2cbf2808-3839-4c26-a04d-fd201dd51f9e
+
+spring.dynamic.thread-pool.apollo.namespace=application
+spring.dynamic.thread-pool.config-file-type=properties
+
+
+spring.dynamic.thread-pool.executors[0].active-alarm = 80
+spring.dynamic.thread-pool.executors[0].alarm = true
+spring.dynamic.thread-pool.executors[0].allow-core-thread-time-out = true
+spring.dynamic.thread-pool.executors[0].blocking-queue = LinkedBlockingQueue
+spring.dynamic.thread-pool.executors[0].capacity-alarm = 80
+spring.dynamic.thread-pool.executors[0].core-pool-size = 1
+spring.dynamic.thread-pool.executors[0].execute-time-out = 1000
+spring.dynamic.thread-pool.executors[0].keep-alive-time = 6691
+spring.dynamic.thread-pool.executors[0].maximum-pool-size = 1
+spring.dynamic.thread-pool.executors[0].notify.interval = 8
+spring.dynamic.thread-pool.executors[0].notify.receives = chen.ma
+spring.dynamic.thread-pool.executors[0].queue-capacity = 1
+spring.dynamic.thread-pool.executors[0].rejected-handler = AbortPolicy
+spring.dynamic.thread-pool.executors[0].thread-name-prefix = message-consume
+spring.dynamic.thread-pool.executors[0].thread-pool-id = message-consume
+spring.dynamic.thread-pool.executors[1].active-alarm = 80
+spring.dynamic.thread-pool.executors[1].alarm = true
+spring.dynamic.thread-pool.executors[1].allow-core-thread-time-out = true
+spring.dynamic.thread-pool.executors[1].blocking-queue = LinkedBlockingQueue
+spring.dynamic.thread-pool.executors[1].capacity-alarm = 80
+spring.dynamic.thread-pool.executors[1].core-pool-size = 1
+spring.dynamic.thread-pool.executors[1].execute-time-out = 1000
+spring.dynamic.thread-pool.executors[1].keep-alive-time = 6691
+spring.dynamic.thread-pool.executors[1].maximum-pool-size = 1
+spring.dynamic.thread-pool.executors[1].notify.interval = 8
+spring.dynamic.thread-pool.executors[1].notify.receives = chen.ma
+spring.dynamic.thread-pool.executors[1].queue-capacity = 1
+spring.dynamic.thread-pool.executors[1].rejected-handler = AbortPolicy
+spring.dynamic.thread-pool.executors[1].thread-name-prefix = message-produce
+spring.dynamic.thread-pool.executors[1].thread-pool-id = message-produce
diff --git a/hippo4j-example/pom.xml b/hippo4j-example/pom.xml
index ee233eb9..82389b21 100644
--- a/hippo4j-example/pom.xml
+++ b/hippo4j-example/pom.xml
@@ -24,6 +24,7 @@
hippo4j-spring-boot-starter-adapter-rocketmq-example
hippo4j-config-etcd-spring-boot-starter-example
hippo4j-config-nacos-spring-boot-1.5-starter-example
+ hippo4j-config-apollo-spring-boot-1.5-starter-example