This is an automated email from the ASF dual-hosted git repository.
gongchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
The following commit(s) were added to refs/heads/master by this push:
new 6421fef54 [Improve] Optimize spring auto configuration registry (#2304)
6421fef54 is described below
commit 6421fef548679df31304209b0d7e8dbbfa993405
Author: YuLuo <[email protected]>
AuthorDate: Sat Jul 20 10:24:51 2024 +0800
[Improve] Optimize spring auto configuration registry (#2304)
Signed-off-by: yuluo-yx <[email protected]>
Co-authored-by: tomsun28 <[email protected]>
---
.../alert/config/AlerterAutoConfiguration.java | 3 +++
alerter/src/main/resources/META-INF/spring.factories | 17 -----------------
...mework.boot.autoconfigure.AutoConfiguration.imports | 2 +-
.../collector/config/CollectorAutoConfiguration.java | 3 +++
collector/src/main/resources/META-INF/spring.factories | 17 -----------------
...mework.boot.autoconfigure.AutoConfiguration.imports | 2 +-
.../apache/hertzbeat/common/config/CommonConfig.java | 5 +++--
common/src/main/resources/META-INF/spring.factories | 18 ------------------
.../hertzbeat/push/config/PushAutoConfiguration.java | 3 +++
push/src/main/resources/META-INF/spring.factories | 17 -----------------
.../{ => config}/WarehouseAutoConfiguration.java | 5 ++++-
warehouse/src/main/resources/META-INF/spring.factories | 17 -----------------
...mework.boot.autoconfigure.AutoConfiguration.imports | 2 +-
13 files changed, 19 insertions(+), 92 deletions(-)
diff --git
a/alerter/src/main/java/org/apache/hertzbeat/alert/config/AlerterAutoConfiguration.java
b/alerter/src/main/java/org/apache/hertzbeat/alert/config/AlerterAutoConfiguration.java
index b0afa2c5b..f9f786612 100644
---
a/alerter/src/main/java/org/apache/hertzbeat/alert/config/AlerterAutoConfiguration.java
+++
b/alerter/src/main/java/org/apache/hertzbeat/alert/config/AlerterAutoConfiguration.java
@@ -17,11 +17,14 @@
package org.apache.hertzbeat.alert.config;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
/**
* Alert auto configuration.
*/
+
+@AutoConfiguration
@ComponentScan(basePackages = "org.apache.hertzbeat.alert")
public class AlerterAutoConfiguration {
}
diff --git a/alerter/src/main/resources/META-INF/spring.factories
b/alerter/src/main/resources/META-INF/spring.factories
deleted file mode 100644
index 13843a794..000000000
--- a/alerter/src/main/resources/META-INF/spring.factories
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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.
-
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.apache.hertzbeat.alert.config.AlerterAutoConfiguration
diff --git
a/alerter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
b/alerter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
index 0becd31fa..bbff659d5 100644
---
a/alerter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
+++
b/alerter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-org.apache.hertzbeat.alert.config.AlerterAutoConfiguration
\ No newline at end of file
+org.apache.hertzbeat.alert.config.AlerterAutoConfiguration
diff --git
a/collector/src/main/java/org/apache/hertzbeat/collector/config/CollectorAutoConfiguration.java
b/collector/src/main/java/org/apache/hertzbeat/collector/config/CollectorAutoConfiguration.java
index e4bfd9095..a94d74488 100644
---
a/collector/src/main/java/org/apache/hertzbeat/collector/config/CollectorAutoConfiguration.java
+++
b/collector/src/main/java/org/apache/hertzbeat/collector/config/CollectorAutoConfiguration.java
@@ -17,12 +17,15 @@
package org.apache.hertzbeat.collector.config;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
/**
* Collector Auto Configuration
* @version 2.1
*/
+
+@AutoConfiguration
@ComponentScan(basePackages = "org.apache.hertzbeat.collector")
public class CollectorAutoConfiguration {
}
diff --git a/collector/src/main/resources/META-INF/spring.factories
b/collector/src/main/resources/META-INF/spring.factories
deleted file mode 100644
index 771bb51c6..000000000
--- a/collector/src/main/resources/META-INF/spring.factories
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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.
-
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.apache.hertzbeat.collector.config.CollectorAutoConfiguration
diff --git
a/collector/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
b/collector/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
index 85622a853..88a05890b 100644
---
a/collector/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
+++
b/collector/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-org.apache.hertzbeat.collector.config.CollectorAutoConfiguration
\ No newline at end of file
+org.apache.hertzbeat.collector.config.CollectorAutoConfiguration
diff --git
a/common/src/main/java/org/apache/hertzbeat/common/config/CommonConfig.java
b/common/src/main/java/org/apache/hertzbeat/common/config/CommonConfig.java
index 7dfaf4ab5..fa51f981e 100644
--- a/common/src/main/java/org/apache/hertzbeat/common/config/CommonConfig.java
+++ b/common/src/main/java/org/apache/hertzbeat/common/config/CommonConfig.java
@@ -18,16 +18,17 @@
package org.apache.hertzbeat.common.config;
import org.apache.hertzbeat.common.util.AesUtil;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
import
org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
/**
* common module config
*/
+
+@AutoConfiguration
@ComponentScan(basePackages = "org.apache.hertzbeat.common")
@EnableConfigurationProperties(CommonProperties.class)
-@Configuration
public class CommonConfig {
public CommonConfig(CommonProperties commonProperties) {
diff --git a/common/src/main/resources/META-INF/spring.factories
b/common/src/main/resources/META-INF/spring.factories
deleted file mode 100644
index 9027bee7c..000000000
--- a/common/src/main/resources/META-INF/spring.factories
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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.
-
-
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.apache.hertzbeat.common.config.CommonConfig
diff --git
a/push/src/main/java/org/apache/hertzbeat/push/config/PushAutoConfiguration.java
b/push/src/main/java/org/apache/hertzbeat/push/config/PushAutoConfiguration.java
index d087c5adc..372897d59 100644
---
a/push/src/main/java/org/apache/hertzbeat/push/config/PushAutoConfiguration.java
+++
b/push/src/main/java/org/apache/hertzbeat/push/config/PushAutoConfiguration.java
@@ -17,11 +17,14 @@
package org.apache.hertzbeat.push.config;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
/**
* push configuration
*/
+
+@AutoConfiguration
@ComponentScan(basePackages = "org.apache.hertzbeat.push")
public class PushAutoConfiguration {
}
diff --git a/push/src/main/resources/META-INF/spring.factories
b/push/src/main/resources/META-INF/spring.factories
deleted file mode 100644
index a433ed2b3..000000000
--- a/push/src/main/resources/META-INF/spring.factories
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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.
-
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.apache.hertzbeat.push.config.PushAutoConfiguration
diff --git
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/WarehouseAutoConfiguration.java
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/config/WarehouseAutoConfiguration.java
similarity index 88%
rename from
warehouse/src/main/java/org/apache/hertzbeat/warehouse/WarehouseAutoConfiguration.java
rename to
warehouse/src/main/java/org/apache/hertzbeat/warehouse/config/WarehouseAutoConfiguration.java
index 498e487e1..72a8a1d51 100644
---
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/WarehouseAutoConfiguration.java
+++
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/config/WarehouseAutoConfiguration.java
@@ -15,14 +15,17 @@
* limitations under the License.
*/
-package org.apache.hertzbeat.warehouse;
+package org.apache.hertzbeat.warehouse.config;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
/**
* WarehouseAutoConfiguration class
* @version 2.1
*/
+
+@AutoConfiguration
@ComponentScan(basePackages = "org.apache.hertzbeat.warehouse")
public class WarehouseAutoConfiguration {
}
diff --git a/warehouse/src/main/resources/META-INF/spring.factories
b/warehouse/src/main/resources/META-INF/spring.factories
deleted file mode 100644
index 2df923ea4..000000000
--- a/warehouse/src/main/resources/META-INF/spring.factories
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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.
-
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.apache.hertzbeat.warehouse.WarehouseAutoConfiguration
diff --git
a/warehouse/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
b/warehouse/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
index 97c492ff3..e9d621619 100644
---
a/warehouse/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
+++
b/warehouse/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-org.apache.hertzbeat.warehouse.WarehouseAutoConfiguration
\ No newline at end of file
+org.apache.hertzbeat.warehouse.config.WarehouseAutoConfiguration
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]