Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
schbrain-parent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
schbrain-parent
Commits
5c3e0dd9
Commit
5c3e0dd9
authored
May 03, 2023
by
liaozan
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorder dependencies
parent
37664e38
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
217 additions
and
181 deletions
+217
-181
commons/common-util/pom.xml
commons/common-util/pom.xml
+4
-0
pom.xml
pom.xml
+141
-141
starters/apollo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/apollo/listener/GenericPropertiesPreparedEventListener.java
...ollo/listener/GenericPropertiesPreparedEventListener.java
+32
-0
starters/apollo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/apollo/listener/PropertiesPreparedEventListener.java
...gure/apollo/listener/PropertiesPreparedEventListener.java
+7
-1
starters/dubbo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/dubbo/listener/DubboPropertiesPreparedEventListener.java
.../dubbo/listener/DubboPropertiesPreparedEventListener.java
+8
-2
starters/logger-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/logger/LoggerAutoConfiguration.java
...amework/autoconfigure/logger/LoggerAutoConfiguration.java
+0
-3
starters/logger-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/logger/listener/LoggerPropertiesPreparedEventListener.java
...ogger/listener/LoggerPropertiesPreparedEventListener.java
+2
-2
starters/mybatis-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/mybatis/datasource/DataSourceConnectionPostProcessor.java
...mybatis/datasource/DataSourceConnectionPostProcessor.java
+6
-7
support/schbrain-spring-support/src/main/java/com/schbrain/framework/support/spring/GenericBeanPostProcessor.java
...in/framework/support/spring/GenericBeanPostProcessor.java
+17
-25
No files found.
commons/common-util/pom.xml
View file @
5c3e0dd9
...
...
@@ -19,6 +19,10 @@
<groupId>
com.schbrain.common
</groupId>
<artifactId>
common
</artifactId>
</dependency>
<dependency>
<groupId>
cglib
</groupId>
<artifactId>
cglib
</artifactId>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
...
...
pom.xml
View file @
5c3e0dd9
...
...
@@ -49,8 +49,8 @@
<schbrain-apollo.version>
${revision}
</schbrain-apollo.version>
<schbrain-base-dao.version>
${revision}
</schbrain-base-dao.version>
<schbrain-cache.version>
${revision}
</schbrain-cache.version>
<schbrain-common-util.version>
${revision}
</schbrain-common-util.version>
<schbrain-common.version>
${revision}
</schbrain-common.version>
<schbrain-common-util.version>
${revision}
</schbrain-common-util.version>
<schbrain-dubbo.version>
${revision}
</schbrain-dubbo.version>
<schbrain-elasticsearch.version>
${revision}
</schbrain-elasticsearch.version>
<schbrain-kafka.version>
${revision}
</schbrain-kafka.version>
...
...
@@ -64,17 +64,15 @@
<!-- 3th part versions -->
<apollo.version>
2.1.0
</apollo.version>
<b
ouncycastle.version>
1.73
</bouncycastle
.version>
<b
cprov-jdk18on.version>
1.73
</bcprov-jdk18on
.version>
<cglib.version>
3.3.0
</cglib.version>
<curator.version>
5.5.0
</curator.version>
<com.google.zxing.version>
3.5.1
</com.google.zxing.version>
<commons-collections4.version>
4.4
</commons-collections4.version>
<commons-compress.version>
1.23.0
</commons-compress.version>
<commons-beanutils.version>
1.9.4
</commons-beanutils.version>
<commons-io.version>
2.11.0
</commons-io.version>
<dubbo.version>
3.2.0
</dubbo.version>
<druid.version>
1.2.17
</druid.version>
<dynamic-datasource.version>
3.5.0
</dynamic-datasource.version>
<easyexcel.version>
3.2.1
</easyexcel.version>
<fastjson.version>
1.2.83
</fastjson.version>
<fastjson2.version>
2.0.29
</fastjson2.version>
...
...
@@ -87,18 +85,17 @@
<mybatis-plus.version>
3.5.3.1
</mybatis-plus.version>
<pinyin4j.version>
2.5.1
</pinyin4j.version>
<pagehelper.version>
5.3.2
</pagehelper.version>
<!-- 3.18.0 is the last version to support spring-boot 2.x -->
<!-- upgrade redisson if switch to spring-boot 3.x -->
<redisson.version>
3.18.0
</redisson.version>
<skywalking-tooklit.version>
8.15.0
</skywalking-tooklit.version>
<xxl-job.version>
2.0.2
</xxl-job.version>
<zookeeper.version>
3.8.1
</zookeeper.version>
<zxing-core.version>
3.5.1
</zxing-core.version>
<!-- aliyun -->
<aliyun-java-sdk-core.version>
4.6.3
</aliyun-java-sdk-core.version>
<aliyun-java-sdk-vod.version>
2.16.16
</aliyun-java-sdk-vod.version>
<aliyun-java-sdk-sts.version>
3.1.1
</aliyun-java-sdk-sts.version>
<aliyun-java-sdk-dypnsapi.version>
1.2.6
</aliyun-java-sdk-dypnsapi.version>
<aliyun-sdk-core.version>
4.6.3
</aliyun-sdk-core.version>
<aliyun-sdk-oss.version>
3.16.2
</aliyun-sdk-oss.version>
<!-- alibabacloud new sdk -->
...
...
@@ -130,36 +127,31 @@
<dependencyManagement>
<dependencies>
<!-- 2th part versions -->
<dependency>
<groupId>
com.schbrain.
common
</groupId>
<artifactId>
common
</artifactId>
<version>
${schbrain-
common
.version}
</version>
<groupId>
com.schbrain.
framework
</groupId>
<artifactId>
apollo-spring-boot-starter
</artifactId>
<version>
${schbrain-
apollo
.version}
</version>
</dependency>
<dependency>
<groupId>
com.schbrain.
common
</groupId>
<artifactId>
common-util
</artifactId>
<version>
${schbrain-
common-util
.version}
</version>
<groupId>
com.schbrain.
framework
</groupId>
<artifactId>
schbrain-base-dao
</artifactId>
<version>
${schbrain-
base-dao
.version}
</version>
</dependency>
<dependency>
<groupId>
com.schbrain.
common
</groupId>
<artifactId>
web-common
</artifactId>
<version>
${schbrain-
web-common
.version}
</version>
<groupId>
com.schbrain.
framework
</groupId>
<artifactId>
cache-spring-boot-starter
</artifactId>
<version>
${schbrain-
cache
.version}
</version>
</dependency>
<dependency>
<groupId>
com.schbrain.common
</groupId>
<artifactId>
module-tree
</artifactId>
<version>
${schbrain-module-tree.version}
</version>
</dependency>
<!-- 二方包 -->
<dependency>
<groupId>
com.schbrain.framework
</groupId>
<artifactId>
apollo-spring-boot-starter
</artifactId>
<version>
${schbrain-apollo.version}
</version>
<artifactId>
common
</artifactId>
<version>
${schbrain-common.version}
</version>
</dependency>
<dependency>
<groupId>
com.schbrain.
framework
</groupId>
<artifactId>
c
ache-spring-boot-starter
</artifactId>
<version>
${schbrain-c
ache
.version}
</version>
<groupId>
com.schbrain.
common
</groupId>
<artifactId>
c
ommon-util
</artifactId>
<version>
${schbrain-c
ommon-util
.version}
</version>
</dependency>
<dependency>
<groupId>
com.schbrain.framework
</groupId>
...
...
@@ -181,6 +173,11 @@
<artifactId>
logger-spring-boot-starter
</artifactId>
<version>
${schbrain-logger.version}
</version>
</dependency>
<dependency>
<groupId>
com.schbrain.common
</groupId>
<artifactId>
module-tree
</artifactId>
<version>
${schbrain-module-tree.version}
</version>
</dependency>
<dependency>
<groupId>
com.schbrain.framework
</groupId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
...
...
@@ -193,30 +190,30 @@
</dependency>
<dependency>
<groupId>
com.schbrain.framework
</groupId>
<artifactId>
xxl-job-spring-boot-starter
</artifactId>
<version>
${schbrain-
xxl
.version}
</version>
<artifactId>
schbrain-spring-support
</artifactId>
<version>
${schbrain-
spring-support
.version}
</version>
</dependency>
<dependency>
<groupId>
com.schbrain.
framework
</groupId>
<artifactId>
schbrain-base-dao
</artifactId>
<version>
${schbrain-
base-dao
.version}
</version>
<groupId>
com.schbrain.
common
</groupId>
<artifactId>
web-common
</artifactId>
<version>
${schbrain-
web-common
.version}
</version>
</dependency>
<dependency>
<groupId>
com.schbrain.framework
</groupId>
<artifactId>
schbrain-spring-support
</artifactId>
<version>
${schbrain-
spring-support
.version}
</version>
<artifactId>
xxl-job-spring-boot-starter
</artifactId>
<version>
${schbrain-
xxl
.version}
</version>
</dependency>
<!--
三方包
-->
<!--
3th part versions
-->
<dependency>
<groupId>
c
n.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
${
hutool
.version}
</version>
<groupId>
c
om.ctrip.framework.apollo
</groupId>
<artifactId>
apollo-client
</artifactId>
<version>
${
apollo
.version}
</version>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk18on
</artifactId>
<version>
${b
ouncycastle
.version}
</version>
<version>
${b
cprov-jdk18on
.version}
</version>
</dependency>
<dependency>
<groupId>
cglib
</groupId>
...
...
@@ -224,19 +221,19 @@
<version>
${cglib.version}
</version>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
${
guava
.version}
</version>
<groupId>
org.apache.curator
</groupId>
<artifactId>
curator-recipes
</artifactId>
<version>
${
curator
.version}
</version>
</dependency>
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
c
ommons-io
</artifactId>
<version>
${c
ommons-io
.version}
</version>
<groupId>
org.apache.curator
</groupId>
<artifactId>
c
urator-x-discovery
</artifactId>
<version>
${c
urator
.version}
</version>
</dependency>
<dependency>
<groupId>
commons-beanutils
</groupId>
<artifactId>
c
ommons-beanutils
</artifactId>
<version>
${c
ommons-beanutils
.version}
</version>
<groupId>
org.apache.curator
</groupId>
<artifactId>
c
urator-framework
</artifactId>
<version>
${c
urator
.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
...
...
@@ -248,6 +245,16 @@
<artifactId>
commons-compress
</artifactId>
<version>
${commons-compress.version}
</version>
</dependency>
<dependency>
<groupId>
commons-beanutils
</groupId>
<artifactId>
commons-beanutils
</artifactId>
<version>
${commons-beanutils.version}
</version>
</dependency>
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
<version>
${commons-io.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang3
</artifactId>
...
...
@@ -258,31 +265,6 @@
<artifactId>
commons-pool2
</artifactId>
<version>
${commons-pool2.version}
</version>
</dependency>
<dependency>
<groupId>
com.belerweb
</groupId>
<artifactId>
pinyin4j
</artifactId>
<version>
${pinyin4j.version}
</version>
</dependency>
<dependency>
<groupId>
com.google.zxing
</groupId>
<artifactId>
core
</artifactId>
<version>
${com.google.zxing.version}
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
${fastjson.version}
</version>
</dependency>
<dependency>
<groupId>
com.alibaba.fastjson2
</groupId>
<artifactId>
fastjson2
</artifactId>
<version>
${fastjson2.version}
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
easyexcel
</artifactId>
<version>
${easyexcel.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo
</artifactId>
...
...
@@ -293,7 +275,6 @@
<artifactId>
dubbo-spring-boot-starter
</artifactId>
<version>
${dubbo.version}
</version>
</dependency>
<!-- user single dependency instead of dubbo-bom, because dubbo-bom set the spring version-->
<dependency>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo-common
</artifactId>
...
...
@@ -356,29 +337,49 @@
</exclusions>
</dependency>
<dependency>
<groupId>
org.apache.zookeeper
</groupId>
<artifactId>
zookeeper
</artifactId>
<version>
${
zookeeper
.version}
</version>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid
</artifactId>
<version>
${
druid
.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.curator
</groupId>
<artifactId>
curator-recipes
</artifactId>
<version>
${
curator
.version}
</version>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
<version>
${
druid
.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.curator
</groupId>
<artifactId>
curator-x-discovery
</artifactId>
<version>
${
curator
.version}
</version>
<groupId>
com.alibaba
</groupId>
<artifactId>
easyexcel
</artifactId>
<version>
${
easyexcel
.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.curator
</groupId>
<artifactId>
curator-framework
</artifactId>
<version>
${
curator
.version}
</version>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
${
fastjson
.version}
</version>
</dependency>
<dependency>
<groupId>
com.github.pagehelper
</groupId>
<artifactId>
pagehelper
</artifactId>
<version>
${pagehelper.version}
</version>
<groupId>
com.alibaba.fastjson2
</groupId>
<artifactId>
fastjson2
</artifactId>
<version>
${fastjson2.version}
</version>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
${guava.version}
</version>
</dependency>
<dependency>
<groupId>
com.google.inject
</groupId>
<artifactId>
guice
</artifactId>
<version>
${guice.version}
</version>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
${hutool.version}
</version>
</dependency>
<dependency>
<groupId>
net.logstash.logback
</groupId>
<artifactId>
logstash-logback-encoder
</artifactId>
<version>
${logstash-logback-encoder.version}
</version>
</dependency>
<dependency>
<groupId>
org.mybatis
</groupId>
...
...
@@ -402,29 +403,56 @@
</exclusions>
</dependency>
<dependency>
<groupId>
com.
alibaba
</groupId>
<artifactId>
druid
</artifactId>
<version>
${
druid
.version}
</version>
<groupId>
com.
belerweb
</groupId>
<artifactId>
pinyin4j
</artifactId>
<version>
${
pinyin4j
.version}
</version>
</dependency>
<dependency>
<groupId>
com.
alibaba
</groupId>
<artifactId>
druid-spring-boot-start
er
</artifactId>
<version>
${
druid
.version}
</version>
<groupId>
com.
github.pagehelper
</groupId>
<artifactId>
pagehelp
er
</artifactId>
<version>
${
pagehelper
.version}
</version>
</dependency>
<dependency>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo-client
</artifactId>
<version>
${
apollo
.version}
</version>
<groupId>
org.redisson
</groupId>
<artifactId>
redisson
</artifactId>
<version>
${
redisson
.version}
</version>
</dependency>
<dependency>
<groupId>
com.google.inject
</groupId>
<artifactId>
guice
</artifactId>
<version>
${guice.version}
</version>
<groupId>
org.redisson
</groupId>
<artifactId>
redisson-spring-boot-starter
</artifactId>
<version>
${redisson.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.skywalking
</groupId>
<artifactId>
apm-toolkit-trace
</artifactId>
<version>
${skywalking-tooklit.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.skywalking
</groupId>
<artifactId>
apm-toolkit-logback-1.x
</artifactId>
<version>
${skywalking-tooklit.version}
</version>
</dependency>
<dependency>
<groupId>
com.xuxueli
</groupId>
<artifactId>
xxl-job-core
</artifactId>
<version>
${xxl-job.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.zookeeper
</groupId>
<artifactId>
zookeeper
</artifactId>
<version>
${zookeeper.version}
</version>
</dependency>
<dependency>
<groupId>
com.google.zxing
</groupId>
<artifactId>
core
</artifactId>
<version>
${zxing-core.version}
</version>
</dependency>
<!-- aliyun -->
<dependency>
<groupId>
com.aliyun
</groupId>
<artifactId>
aliyun-java-sdk-core
</artifactId>
<version>
${aliyun-sdk-core.version}
</version>
<version>
${aliyun-
java-
sdk-core.version}
</version>
<exclusions>
<exclusion>
<groupId>
commons-logging
</groupId>
...
...
@@ -436,6 +464,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.aliyun
</groupId>
<artifactId>
aliyun-java-sdk-vod
</artifactId>
<version>
${aliyun-java-sdk-vod.version}
</version>
</dependency>
<dependency>
<groupId>
com.aliyun.oss
</groupId>
<artifactId>
aliyun-sdk-oss
</artifactId>
...
...
@@ -449,14 +482,15 @@
</dependency>
<dependency>
<groupId>
com.aliyun
</groupId>
<artifactId>
aliyun-java-sdk-
vod
</artifactId>
<version>
${aliyun-java-sdk-
vod
.version}
</version>
<artifactId>
aliyun-java-sdk-
sts
</artifactId>
<version>
${aliyun-java-sdk-
sts
.version}
</version>
</dependency>
<dependency>
<groupId>
com.aliyun
</groupId>
<artifactId>
aliyun-java-sdk-
sts
</artifactId>
<version>
${aliyun-java-sdk-
sts
.version}
</version>
<artifactId>
aliyun-java-sdk-
dypnsapi
</artifactId>
<version>
${aliyun-java-sdk-
dypnsapi
.version}
</version>
</dependency>
<!-- alibabacloud new sdk -->
<dependency>
<groupId>
com.aliyun
</groupId>
...
...
@@ -468,11 +502,6 @@
<artifactId>
aliyun-gateway-pop
</artifactId>
<version>
${aliyun-gateway-pop.version}
</version>
</dependency>
<dependency>
<groupId>
com.aliyun
</groupId>
<artifactId>
aliyun-java-sdk-dypnsapi
</artifactId>
<version>
${aliyun-java-sdk-dypnsapi.version}
</version>
</dependency>
<dependency>
<groupId>
com.aliyun
</groupId>
<artifactId>
alibabacloud-sts20150401
</artifactId>
...
...
@@ -493,6 +522,7 @@
<artifactId>
alibabacloud-dysmsapi20170525
</artifactId>
<version>
${alibabacloud-dysmsapi20170525.version}
</version>
</dependency>
<!-- dingtalk sdk -->
<dependency>
<groupId>
com.aliyun
</groupId>
...
...
@@ -504,36 +534,6 @@
<artifactId>
dingtalk
</artifactId>
<version>
${aliyun-dingtalk-sdk.version}
</version>
</dependency>
<dependency>
<groupId>
org.redisson
</groupId>
<artifactId>
redisson
</artifactId>
<version>
${redisson.version}
</version>
</dependency>
<dependency>
<groupId>
org.redisson
</groupId>
<artifactId>
redisson-spring-boot-starter
</artifactId>
<version>
${redisson.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.skywalking
</groupId>
<artifactId>
apm-toolkit-trace
</artifactId>
<version>
${skywalking-tooklit.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.skywalking
</groupId>
<artifactId>
apm-toolkit-logback-1.x
</artifactId>
<version>
${skywalking-tooklit.version}
</version>
</dependency>
<dependency>
<groupId>
net.logstash.logback
</groupId>
<artifactId>
logstash-logback-encoder
</artifactId>
<version>
${logstash-logback-encoder.version}
</version>
</dependency>
<dependency>
<groupId>
com.xuxueli
</groupId>
<artifactId>
xxl-job-core
</artifactId>
<version>
${xxl-job.version}
</version>
</dependency>
</dependencies>
</dependencyManagement>
...
...
starters/apollo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/apollo/listener/
PropertiesPreparedEventListenerAdapt
er.java
→
starters/apollo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/apollo/listener/
GenericPropertiesPreparedEventListen
er.java
View file @
5c3e0dd9
...
...
@@ -2,37 +2,31 @@ package com.schbrain.framework.autoconfigure.apollo.listener;
import
com.schbrain.common.util.support.ConfigurableProperties
;
import
org.apache.commons.logging.Log
;
import
java.lang.reflect.ParameterizedType
;
import
java.lang.reflect.Type
;
import
org.springframework.core.ResolvableType
;
/**
* @author liaozan
* @since 2023-04-28
*/
@SuppressWarnings
(
"unchecked"
)
public
class
PropertiesPreparedEventListenerAdapt
er
<
T
extends
ConfigurableProperties
>
implements
PropertiesPreparedEventListener
{
public
abstract
class
GenericPropertiesPreparedEventListen
er
<
T
extends
ConfigurableProperties
>
implements
PropertiesPreparedEventListener
{
pr
ivate
final
Class
<
T
>
property
Type
;
pr
otected
final
ResolvableType
properties
Type
;
protected
Log
log
;
public
PropertiesPreparedEventListenerAdapter
()
{
ParameterizedType
parameterizedType
=
(
ParameterizedType
)
getClass
().
getGenericSuperclass
();
Type
[]
actualTypeArguments
=
parameterizedType
.
getActualTypeArguments
();
this
.
propertyType
=
(
Class
<
T
>)
actualTypeArguments
[
0
];
public
GenericPropertiesPreparedEventListener
()
{
this
.
propertiesType
=
ResolvableType
.
forInstance
(
this
).
getSuperType
().
getGeneric
(
0
);
}
@Override
public
void
onApplicationEvent
(
PropertiesPreparedEvent
event
)
{
if
(
event
.
getConfigurableProperties
().
getClass
()
==
propertyType
)
{
this
.
log
=
event
.
getDeferredLogFactory
().
getLog
(
this
.
getClass
());
if
(
propertiesType
.
isInstance
(
event
.
getConfigurableProperties
())
)
{
this
.
log
=
event
.
getDeferredLogFactory
().
getLog
(
getClass
());
this
.
onPropertiesPrepared
(
event
,
(
T
)
event
.
getConfigurableProperties
());
}
}
protected
void
onPropertiesPrepared
(
PropertiesPreparedEvent
event
,
T
configurableProperties
)
{
}
protected
abstract
void
onPropertiesPrepared
(
PropertiesPreparedEvent
event
,
T
configurableProperties
);
}
\ No newline at end of file
starters/apollo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/apollo/listener/PropertiesPreparedEventListener.java
View file @
5c3e0dd9
package
com.schbrain.framework.autoconfigure.apollo.listener
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.core.Ordered
;
/**
* @author liaozan
* @since 2023-04-29
*/
public
interface
PropertiesPreparedEventListener
extends
ApplicationListener
<
PropertiesPreparedEvent
>
{
public
interface
PropertiesPreparedEventListener
extends
ApplicationListener
<
PropertiesPreparedEvent
>,
Ordered
{
@Override
default
int
getOrder
()
{
return
Ordered
.
LOWEST_PRECEDENCE
;
}
}
\ No newline at end of file
starters/dubbo-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/dubbo/listener/DubboPropertiesPreparedEventListener.java
View file @
5c3e0dd9
...
...
@@ -3,13 +3,14 @@ package com.schbrain.framework.autoconfigure.dubbo.listener;
import
com.alibaba.fastjson2.JSONFactory
;
import
com.google.common.collect.Maps
;
import
com.schbrain.common.util.ApplicationName
;
import
com.schbrain.framework.autoconfigure.apollo.listener.GenericPropertiesPreparedEventListener
;
import
com.schbrain.framework.autoconfigure.apollo.listener.PropertiesPreparedEvent
;
import
com.schbrain.framework.autoconfigure.apollo.listener.PropertiesPreparedEventListenerAdapter
;
import
com.schbrain.framework.autoconfigure.dubbo.properties.DubboProperties
;
import
org.apache.dubbo.config.bootstrap.DubboBootstrap
;
import
org.apache.dubbo.config.spring.ConfigCenterBean
;
import
org.apache.dubbo.config.spring.util.EnvironmentUtils
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.core.Ordered
;
import
org.springframework.core.env.ConfigurableEnvironment
;
import
java.util.Map
;
...
...
@@ -21,10 +22,15 @@ import static org.apache.dubbo.config.ConfigKeys.DUBBO_SCAN_BASE_PACKAGES;
* @author liaozan
* @since 2023-04-28
*/
public
class
DubboPropertiesPreparedEventListener
extends
PropertiesPreparedEventListenerAdapt
er
<
DubboProperties
>
{
public
class
DubboPropertiesPreparedEventListener
extends
GenericPropertiesPreparedEventListen
er
<
DubboProperties
>
{
public
static
final
String
DUBBO_APPLICATION_NAME
=
"dubbo.application.name"
;
@Override
public
int
getOrder
()
{
return
Ordered
.
HIGHEST_PRECEDENCE
;
}
@Override
protected
void
onPropertiesPrepared
(
PropertiesPreparedEvent
event
,
DubboProperties
properties
)
{
ConfigurableEnvironment
environment
=
event
.
getEnvironment
();
...
...
starters/logger-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/logger/LoggerAutoConfiguration.java
View file @
5c3e0dd9
...
...
@@ -3,10 +3,8 @@ package com.schbrain.framework.autoconfigure.logger;
import
com.schbrain.framework.autoconfigure.logger.apollo.DynamicLoggerConfiguration
;
import
com.schbrain.framework.autoconfigure.logger.properties.LoggerProperties
;
import
org.springframework.boot.autoconfigure.AutoConfiguration
;
import
org.springframework.boot.autoconfigure.AutoConfigureOrder
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.core.Ordered
;
/**
* @author liaozan
...
...
@@ -14,7 +12,6 @@ import org.springframework.core.Ordered;
*/
@AutoConfiguration
@Import
(
DynamicLoggerConfiguration
.
class
)
@AutoConfigureOrder
(
Ordered
.
HIGHEST_PRECEDENCE
)
@EnableConfigurationProperties
(
LoggerProperties
.
class
)
public
class
LoggerAutoConfiguration
{
...
...
starters/logger-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/logger/listener/LoggerPropertiesPreparedEventListener.java
View file @
5c3e0dd9
...
...
@@ -8,8 +8,8 @@ import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
import
com.google.common.collect.Maps
;
import
com.schbrain.common.util.InetUtils
;
import
com.schbrain.common.util.InetUtils.HostInfo
;
import
com.schbrain.framework.autoconfigure.apollo.listener.GenericPropertiesPreparedEventListener
;
import
com.schbrain.framework.autoconfigure.apollo.listener.PropertiesPreparedEvent
;
import
com.schbrain.framework.autoconfigure.apollo.listener.PropertiesPreparedEventListenerAdapter
;
import
com.schbrain.framework.autoconfigure.logger.LoggerConfigurationInitializer
;
import
com.schbrain.framework.autoconfigure.logger.properties.LoggerProperties
;
import
org.springframework.core.env.ConfigurableEnvironment
;
...
...
@@ -25,7 +25,7 @@ import static org.springframework.boot.context.logging.LoggingApplicationListene
* @author liaozan
* @since 2023-04-28
*/
public
class
LoggerPropertiesPreparedEventListener
extends
PropertiesPreparedEventListenerAdapt
er
<
LoggerProperties
>
{
public
class
LoggerPropertiesPreparedEventListener
extends
GenericPropertiesPreparedEventListen
er
<
LoggerProperties
>
{
@Override
protected
void
onPropertiesPrepared
(
PropertiesPreparedEvent
event
,
LoggerProperties
properties
)
{
...
...
starters/mybatis-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/mybatis/datasource/DataSourceConnectionPostProcessor.java
View file @
5c3e0dd9
...
...
@@ -2,7 +2,7 @@ package com.schbrain.framework.autoconfigure.mybatis.datasource;
import
com.schbrain.framework.autoconfigure.mybatis.datasource.customizer.DataSourceCustomizer
;
import
com.schbrain.framework.autoconfigure.mybatis.properties.DataSourceConnectionProperties
;
import
com.schbrain.framework.support.spring.
BeanPostProcessorAdapte
r
;
import
com.schbrain.framework.support.spring.
GenericBeanPostProcesso
r
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.ObjectProvider
;
...
...
@@ -15,7 +15,7 @@ import java.sql.SQLException;
* @since 2021/11/23
*/
@Slf4j
public
class
DataSourceConnectionPostProcessor
extends
BeanPostProcessorAdapte
r
<
DataSource
>
{
public
class
DataSourceConnectionPostProcessor
extends
GenericBeanPostProcesso
r
<
DataSource
>
{
// use ObjectProvider to avoid early initialization beans
private
final
ObjectProvider
<
DataSourceCustomizer
>
customizers
;
...
...
@@ -29,14 +29,13 @@ public class DataSourceConnectionPostProcessor extends BeanPostProcessorAdapter<
@Override
protected
void
processBeforeInitialization
(
DataSource
dataSource
,
String
beanName
)
throws
BeansException
{
DataSourceConnectionProperties
connectionProperties
=
this
.
connectionProperties
.
getObject
();
customizers
.
orderedStream
().
forEach
(
customizer
->
{
this
.
connectionProperties
.
ifAvailable
(
properties
->
customizers
.
orderedStream
().
forEach
(
customizer
->
{
try
{
customizer
.
customize
(
dataSource
,
connectionP
roperties
);
customizer
.
customize
(
dataSource
,
p
roperties
);
}
catch
(
SQLException
e
)
{
log
.
warn
(
"
f
ailed to customize dataSource connectionProperties"
,
e
);
log
.
warn
(
"
F
ailed to customize dataSource connectionProperties"
,
e
);
}
});
})
)
;
}
}
\ No newline at end of file
support/schbrain-spring-support/src/main/java/com/schbrain/framework/support/spring/
BeanPostProcessorAdapte
r.java
→
support/schbrain-spring-support/src/main/java/com/schbrain/framework/support/spring/
GenericBeanPostProcesso
r.java
View file @
5c3e0dd9
...
...
@@ -4,21 +4,18 @@ import org.springframework.beans.BeansException;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor
;
import
org.springframework.context.*
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.env.ConfigurableEnvironment
;
import
org.springframework.util.Assert
;
import
org.springframework.util.ClassUtils
;
import
java.lang.reflect.ParameterizedType
;
import
java.lang.reflect.Type
;
/**
* @author liaozan
* @since 2021/11/22
*/
@SuppressWarnings
({
"unchecked"
,
"unused"
})
public
abstract
class
BeanPostProcessorAdapte
r
<
T
>
implements
SmartInstantiationAwareBeanPostProcessor
,
ApplicationContextAware
{
public
abstract
class
GenericBeanPostProcesso
r
<
T
>
implements
SmartInstantiationAwareBeanPostProcessor
,
ApplicationContextAware
{
private
final
Class
<
T
>
beanType
;
private
final
ResolvableType
beanType
;
protected
ConfigurableApplicationContext
applicationContext
;
...
...
@@ -26,38 +23,37 @@ public abstract class BeanPostProcessorAdapter<T> implements SmartInstantiationA
protected
ConfigurableEnvironment
environment
;
public
BeanPostProcessorAdapter
()
{
ParameterizedType
parameterizedType
=
(
ParameterizedType
)
getClass
().
getGenericSuperclass
();
Type
[]
actualTypeArguments
=
parameterizedType
.
getActualTypeArguments
();
this
.
beanType
=
(
Class
<
T
>)
actualTypeArguments
[
0
];
public
GenericBeanPostProcessor
()
{
this
.
beanType
=
ResolvableType
.
forInstance
(
this
).
getSuperType
().
getGeneric
(
0
);
}
@Override
public
final
Object
postProcessBeforeInstantiation
(
Class
<?>
beanClass
,
String
beanName
)
throws
BeansException
{
if
(
ClassUtils
.
isAssignable
(
beanType
,
beanClass
))
{
if
(
beanType
.
isAssignableFrom
(
beanClass
))
{
return
doPostProcessBeforeInstantiation
((
Class
<
T
>)
beanClass
);
}
return
null
;
}
@Override
public
final
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
if
(
ClassUtils
.
isAssignableValue
(
beanType
,
bean
))
{
return
doPostProcessBeforeInitialization
((
T
)
bean
,
beanName
);
}
return
bean
;
}
public
final
boolean
postProcessAfterInstantiation
(
Object
bean
,
String
beanName
)
throws
BeansException
{
if
(
ClassUtils
.
isAssignableValue
(
beanType
,
bean
))
{
if
(
beanType
.
isInstance
(
bean
))
{
return
doPostProcessAfterInstantiation
((
T
)
bean
);
}
return
true
;
}
@Override
public
final
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
if
(
beanType
.
isInstance
(
bean
))
{
return
doPostProcessBeforeInitialization
((
T
)
bean
,
beanName
);
}
return
bean
;
}
@Override
public
final
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
if
(
ClassUtils
.
isAssignableValue
(
beanType
,
bean
))
{
if
(
beanType
.
isInstance
(
bean
))
{
return
doPostProcessAfterInitialization
((
T
)
bean
,
beanName
);
}
return
bean
;
...
...
@@ -65,16 +61,12 @@ public abstract class BeanPostProcessorAdapter<T> implements SmartInstantiationA
@Override
public
void
setApplicationContext
(
ApplicationContext
context
)
throws
BeansException
{
Assert
.
isInstanceOf
(
ConfigurableApplicationContext
.
class
,
context
,
"
r
equire ConfigurableApplicationContext"
);
Assert
.
isInstanceOf
(
ConfigurableApplicationContext
.
class
,
context
,
"
R
equire ConfigurableApplicationContext"
);
this
.
applicationContext
=
(
ConfigurableApplicationContext
)
context
;
this
.
beanFactory
=
this
.
applicationContext
.
getBeanFactory
();
this
.
environment
=
this
.
applicationContext
.
getEnvironment
();
}
public
final
Class
<
T
>
getBeanType
()
{
return
beanType
;
}
// region Instantiation
protected
T
doPostProcessBeforeInstantiation
(
Class
<
T
>
beanClass
)
{
return
null
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment