Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: First support native-image for seata-client #5234

Draft
wants to merge 119 commits into
base: 2.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
e3f03a5
feature: First support native-image
wangliang181230 Jan 6, 2023
8586822
fix style
wangliang181230 Jan 6, 2023
672eacd
日志级别调整。
wangliang181230 Jan 6, 2023
c5b1d12
小调整。
wangliang181230 Jan 6, 2023
b00e8f3
fix and optimize
wangliang181230 Jan 6, 2023
4ecb740
register service files to resources hints
wangliang181230 Jan 6, 2023
cf07e9b
调整错误的注释。
wangliang181230 Jan 6, 2023
5e41eca
优化。
wangliang181230 Jan 6, 2023
3e2d87e
optimize: get config
wangliang181230 Jan 6, 2023
1c15962
优化。
wangliang181230 Jan 6, 2023
fadb8e4
revert
wangliang181230 Jan 6, 2023
1d3479b
optimize log
wangliang181230 Jan 6, 2023
b8c1f7e
revert
wangliang181230 Jan 6, 2023
724e1cc
重命名aot相关类。
wangliang181230 Jan 6, 2023
d03ab74
重命名包。
wangliang181230 Jan 6, 2023
889b582
fix style
wangliang181230 Jan 6, 2023
ae4adc5
fix style
wangliang181230 Jan 6, 2023
98a9aa6
add license header
wangliang181230 Jan 6, 2023
d0c5504
fix style
wangliang181230 Jan 6, 2023
51fc6f9
support jdk proxy
wangliang181230 Jan 6, 2023
43e2447
fix style
wangliang181230 Jan 6, 2023
eca48ad
fix properties type
wangliang181230 Jan 6, 2023
df2f862
revert
wangliang181230 Jan 6, 2023
69c590d
optimize method names
wangliang181230 Jan 6, 2023
cf55bed
optimize
wangliang181230 Jan 6, 2023
72174b4
optimize
wangliang181230 Jan 6, 2023
6ec812d
add AotUtils.getNativeImageCode()
wangliang181230 Jan 6, 2023
0d6210f
fix style
wangliang181230 Jan 6, 2023
17f88f2
fix style
wangliang181230 Jan 6, 2023
5af47b8
optimize code
wangliang181230 Jan 6, 2023
526d906
fix style
wangliang181230 Jan 6, 2023
1322170
fix properties type
wangliang181230 Jan 6, 2023
0a7e746
optimize
wangliang181230 Jan 6, 2023
55083c5
Merge remote-tracking branch 'upstream/develop' into support-native-i…
wangliang181230 Jan 9, 2023
fe21062
修改模块名。
wangliang181230 Jan 9, 2023
ef56959
添加注释。
wangliang181230 Jan 9, 2023
58f333d
注释小调整。
wangliang181230 Jan 9, 2023
fea428c
Merge remote-tracking branch 'upstream/develop' into optimize-getConfig
wangliang181230 Jan 9, 2023
4b52d05
大量调整。
wangliang181230 Jan 9, 2023
e240563
修复配置值。
wangliang181230 Jan 9, 2023
2994da6
优化代码。
wangliang181230 Jan 9, 2023
15e64ab
撤回部分代码。
wangliang181230 Jan 9, 2023
63bb177
移除多余的import
wangliang181230 Jan 9, 2023
941cead
修复另一个BUG。
wangliang181230 Jan 9, 2023
e65d8ec
代码重构。
wangliang181230 Jan 9, 2023
11484c3
Merge branch 'optimize-getConfig' into support-native-image
wangliang181230 Jan 9, 2023
45c39de
修复BUG。
wangliang181230 Jan 9, 2023
93a256d
Merge branch 'optimize-getConfig' into support-native-image
wangliang181230 Jan 9, 2023
61f3bd5
fix load properties fields error.
wangliang181230 Jan 9, 2023
97d5dbc
调整注释。
wangliang181230 Jan 9, 2023
60a112f
优化代码。减少注册的 caffeine 的类,仅注册使用到的实现类。
wangliang181230 Jan 10, 2023
e4fa90e
fix style
wangliang181230 Jan 10, 2023
085c728
fix style
wangliang181230 Jan 10, 2023
c9c6887
register more caffeine class
wangliang181230 Jan 10, 2023
f5d67cc
添加日志。
wangliang181230 Jan 10, 2023
8001f49
Merge branch 'optimize-getConfig' into support-native-image
wangliang181230 Jan 10, 2023
710bd6d
移除不再需要的工具方法。
wangliang181230 Jan 10, 2023
6433bc8
添加几个需要注册的类。
wangliang181230 Jan 10, 2023
8974cab
优化几处代码。
wangliang181230 Jan 10, 2023
ead136e
Merge branch 'optimize-getConfig' into support-native-image
wangliang181230 Jan 10, 2023
52113a9
Merge branch 'develop' into optimize-getConfig
wangliang181230 Jan 10, 2023
46624bc
Merge branch 'develop' into support-native-image
wangliang181230 Jan 10, 2023
638da1b
Merge remote-tracking branch 'upstream/develop' into support-native-i…
wangliang181230 Jan 11, 2023
fe71844
Merge remote-tracking branch 'upstream/develop' into optimize-getConfig
wangliang181230 Jan 11, 2023
8a3524f
支持nacos 1.x
wangliang181230 Jan 12, 2023
dbd1223
重构AOT相关模块。
wangliang181230 Jan 13, 2023
8aa0669
Merge remote-tracking branch 'upstream/develop' into support-native-i…
wangliang181230 Jan 13, 2023
a3982e2
修复循环依赖
wangliang181230 Jan 13, 2023
9ce9d9f
seata-all 合并 aot.factories
wangliang181230 Jan 13, 2023
ebad4a9
添加 NativeUtils,优化依赖关系。
wangliang181230 Jan 13, 2023
889b2da
调整shade相关配置,用于合并 /META-INF/spring/aot.factories
wangliang181230 Jan 13, 2023
cc1cf71
Merge branch 'develop' into optimize-getConfig
wangliang181230 Jan 16, 2023
8f751c2
优化日志。
wangliang181230 Jan 16, 2023
ec58bb2
日志小调整。
wangliang181230 Jan 16, 2023
edce7d9
Merge branch 'optimize-getConfig' into support-native-image
wangliang181230 Jan 16, 2023
56bf3d1
小调整。
wangliang181230 Jan 16, 2023
429a29b
再次优化,解决所有ClassCostException的情况。
wangliang181230 Jan 17, 2023
b1888b4
Merge branch 'optimize-getConfig' into support-native-image
wangliang181230 Jan 17, 2023
e18d1f2
Merge branch 'develop' into optimize-getConfig
wangliang181230 Jan 28, 2023
e83e6dc
调用方法有误,调整掉。
wangliang181230 Jan 28, 2023
7b5a27d
小调整。
wangliang181230 Jan 28, 2023
887b368
小调整。
wangliang181230 Jan 28, 2023
dc5b758
Merge branch 'optimize-getConfig' into support-native-image
wangliang181230 Jan 29, 2023
9ec1baf
类型相同时,不进行类型转换。
wangliang181230 Jan 29, 2023
192e8eb
Merge branch 'optimize-getConfig' into support-native-image
wangliang181230 Jan 29, 2023
be334ec
Merge branch 'develop' into optimize-getConfig
wangliang181230 Jan 29, 2023
9e0a0c0
Merge branch 'optimize-getConfig' into support-native-image
wangliang181230 Jan 29, 2023
b61ffbd
fix style
wangliang181230 Jan 29, 2023
528c927
优化单元测试。
wangliang181230 Jan 29, 2023
9ed410c
注释中,添加获取配置的序号。
wangliang181230 Jan 29, 2023
92ff9ae
Merge remote-tracking branch 'origin/optimize-getConfig' into support…
wangliang181230 Jan 29, 2023
fc60a70
修复一个线程安全问题。
wangliang181230 Jan 29, 2023
4c4d58c
modify develop.md
wangliang181230 Jan 29, 2023
fa1fa81
optimize log
wangliang181230 Jan 29, 2023
66801d6
optimize log
wangliang181230 Jan 29, 2023
a4661a9
Merge branch 'develop' into optimize-getConfig
wangliang181230 Jan 29, 2023
58c0d28
optimize log
wangliang181230 Jan 29, 2023
91551f3
Merge branch 'optimize-getConfig' into support-native-image
wangliang181230 Jan 29, 2023
9d97b00
Merge remote-tracking branch 'upstream/develop' into support-native-i…
wangliang181230 Jan 29, 2023
7d290cd
fix style
wangliang181230 Jan 29, 2023
851ed6d
optimize: fix the problem that protobuf compilation fails(for dev) (#…
GoodBoyCoder Feb 1, 2023
fb3d5c7
bugfix: the console has queried the released lock (#5266)
renliangyu857 Feb 1, 2023
cee99cd
bugfix: parallel request handle throw IndexOutOfBoundsException (#5281)
funky-eyes Feb 2, 2023
9464294
bugfix: After 1.6.0, auto-increment of pgsql pk columns are no longer…
isharpever Feb 3, 2023
01a1ff9
bugfix: After 1.6.0, auto-increment of oracle pk columns are no longe…
isharpever Feb 3, 2023
bf5586f
optimize: remove startup script the -Xmn configuration (#5303)
mxsm Feb 6, 2023
5af2061
Merge remote-tracking branch 'upstream/develop' into support-native-i…
wangliang181230 Feb 7, 2023
9a298fd
bugfix: that keywords don't add escaped characters (#5307)
funky-eyes Feb 7, 2023
83db274
bugfix: don't remove GlobalSession when retry rollback or retry commi…
ZhangShiYeChina Feb 7, 2023
9a87418
Merge remote-tracking branch 'upstream/develop' into support-native-i…
wangliang181230 Feb 7, 2023
b0f63cd
Merge remote-tracking branch 'upstream/2.x' into support-native-image
wangliang181230 Feb 7, 2023
36e8929
撤回一些并非当前PR修改的代码。
wangliang181230 Feb 7, 2023
ac75874
移除多余的imports
wangliang181230 Feb 7, 2023
e3f9dac
撤回一个文件的变更。
wangliang181230 Feb 7, 2023
ce007a3
Merge remote-tracking branch 'upstream/2.x' into support-native-image
wangliang181230 Feb 7, 2023
019b5da
Merge branch '2.x' into support-native-image
wangliang181230 Feb 9, 2023
12901ce
seata-rm-datasource模块,添加native-image.properties文件。
wangliang181230 Feb 9, 2023
2c40a09
eureka-client:1.10.x,也可在native-image中使用了。
wangliang181230 Feb 10, 2023
2fe3fde
优化 reflect-config.json
wangliang181230 Feb 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 33 additions & 6 deletions all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,26 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-aot-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-aot-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-aot-nacos</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-aot-zk</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-tcc</artifactId>
Expand Down Expand Up @@ -623,6 +643,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -641,17 +668,17 @@
</artifactSet>
<transformers>
<!-- META-INF/services -->
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<!-- spring相关 -->
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
<transformer implementation="org.springframework.boot.maven.PropertiesMergingResourceTransformer">
<resource>META-INF/spring/aot.factories</resource>
</transformer>
</transformers>
<filters>
<filter>
Expand Down
2 changes: 1 addition & 1 deletion build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<maven-source-plugin.version>2.2.1</maven-source-plugin.version>
<maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
<maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
<maven-shade-plugin.version>2.4.3</maven-shade-plugin.version>
<maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
<maven-dependency-plugin.version>3.0.2</maven-dependency-plugin.version>
<maven-assembly-plugin.version>3.0.0</maven-assembly-plugin.version>
<jib-maven-plugin.version>3.2.0</jib-maven-plugin.version>
Expand Down
63 changes: 63 additions & 0 deletions common/src/main/java/io/seata/common/aot/NativeUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed 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 io.seata.common.aot;

/**
* The native utils
*
* @author wang.liang
*/
public class NativeUtils {

/**
* The native-image code
*
* @see <a href="https://github.com/oracle/graal/blob/master/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/ImageInfo.java">ImageInfo.java</a>
*/
private static final String NATIVE_IMAGE_CODE = System.getProperty("org.graalvm.nativeimage.imagecode");


public static final String SPRING_AOT_PROCESSING = "spring.aot.processing";


/**
* Whether Spring-AOT processing
*
* @return the boolean
*/
public static boolean isSpringAotProcessing() {
return "true".equalsIgnoreCase(System.getProperty(SPRING_AOT_PROCESSING));
}

/**
* Gets the native-image code.
*
* @return the native-image code
*/
public static String getNativeImageCode() {
return NATIVE_IMAGE_CODE;
}

/**
* Whether run in native-image
*
* @return the boolean
* @see org.springframework.core.NativeDetector#inNativeImage()
*/
public static boolean inNativeImage() {
return NATIVE_IMAGE_CODE != null;
}
}
19 changes: 19 additions & 0 deletions common/src/main/java/io/seata/common/util/ReflectionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,25 @@ public static Class<?> getWrappedClass(Class<?> clazz) {
return clazz;
}

public static boolean isJavaClass(Class<?> clazz) {
return clazz != null && clazz.getClassLoader() == null;
}

/**
* Whether the class exists
*
* @param className the class name
* @return the boolean
*/
public static boolean existsClass(String className) {
try {
getClassByName(className);
return true;
} catch (ClassNotFoundException e) {
return false;
}
}

//endregion


Expand Down
4 changes: 0 additions & 4 deletions config/seata-config-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
*/
package io.seata.config;

import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

import io.seata.common.util.CollectionUtils;
import io.seata.common.util.DurationUtil;
import io.seata.common.util.StringUtils;
import net.bytebuddy.ByteBuddy;
import net.bytebuddy.implementation.InvocationHandlerAdapter;
import net.bytebuddy.matcher.ElementMatchers;

/**
* @author funkye
Expand Down Expand Up @@ -101,8 +100,8 @@ public void onChangeEvent(ConfigurationChangeEvent event) {
}

public Configuration proxy(Configuration originalConfiguration) throws Exception {
return new ByteBuddy().subclass(Configuration.class).method(ElementMatchers.any())
.intercept(InvocationHandlerAdapter.of((proxy, method, args) -> {
return (Configuration)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[]{Configuration.class}
, (proxy, method, args) -> {
String methodName = method.getName();
if (methodName.startsWith(METHOD_PREFIX) && !methodName.equalsIgnoreCase(METHOD_LATEST_CONFIG)) {
String rawDataId = (String)args[0];
Expand All @@ -126,8 +125,8 @@ public Configuration proxy(Configuration originalConfiguration) throws Exception
return wrapper == null ? null : wrapper.convertData(type);
}
return method.invoke(originalConfiguration, args);
})).make().load(originalConfiguration.getClass().getClassLoader()).getLoaded().getDeclaredConstructor()
.newInstance();
}
);
}

private static class ConfigurationCacheInstance {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ public class ZookeeperConfiguration extends AbstractConfiguration {
private static final String CONNECT_TIMEOUT_KEY = "connectTimeout";
private static final String AUTH_USERNAME = "username";
private static final String AUTH_PASSWORD = "password";
private static final String SERIALIZER_KEY = "serializer";
public static final String SERIALIZER_KEY = "serializer";
private static final String CONFIG_PATH_KEY = "nodePath";
private static final int THREAD_POOL_NUM = 1;
private static final int DEFAULT_SESSION_TIMEOUT = 6000;
private static final int DEFAULT_CONNECT_TIMEOUT = 2000;
private static final String DEFAULT_CONFIG_PATH = ROOT_PATH + "/seata.properties";
private static final String FILE_CONFIG_KEY_PREFIX = FILE_ROOT_CONFIG + FILE_CONFIG_SPLIT_CHAR + CONFIG_TYPE
public static final String FILE_CONFIG_KEY_PREFIX = FILE_ROOT_CONFIG + FILE_CONFIG_SPLIT_CHAR + CONFIG_TYPE
+ FILE_CONFIG_SPLIT_CHAR;
private static final ExecutorService CONFIG_EXECUTOR = new ThreadPoolExecutor(THREAD_POOL_NUM, THREAD_POOL_NUM,
Integer.MAX_VALUE, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private SerializerServiceLoader() {
}


private static final String PROTOBUF_SERIALIZER_CLASS_NAME = "io.seata.serializer.protobuf.ProtobufSerializer";
public static final String PROTOBUF_SERIALIZER_CLASS_NAME = "io.seata.serializer.protobuf.ProtobufSerializer";

/**
* Load the service of {@link Serializer}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"condition": {
"typeReachable": "com.netflix.discovery.DiscoveryClient"
},
"name": "com.thoughtworks.xstream.XStream",
"allPublicMethods": true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Args = --initialize-at-build-time=org.apache.commons.logging.LogFactory \
--initialize-at-build-time=org.apache.commons.logging.LogFactoryService
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
<module>rm</module>
<module>rm-datasource</module>
<module>spring</module>
<module>spring-aot</module>
<module>spring-framework-fake-for-java8</module>
<module>tcc</module>
<module>test</module>
<module>tm</module>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Args = -H:+AddAllCharsets
14 changes: 14 additions & 0 deletions seata-spring-autoconfigure/seata-spring-autoconfigure-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,19 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seata-spring-framework-fake-for-java8</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<!-- During development, replace `seata-spring-framework-fake-for-java8` with the following dependency. -->
<!--<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>6.0.4</version>
<scope>provided</scope>
</dependency>-->
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed 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 io.seata.spring.aot;

import io.seata.common.util.ReflectionUtil;
import io.seata.spring.boot.autoconfigure.StarterConstants;
import org.springframework.aot.generate.GenerationContext;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.ReflectionHints;
import org.springframework.beans.factory.aot.BeanRegistrationAotContribution;
import org.springframework.beans.factory.aot.BeanRegistrationAotProcessor;
import org.springframework.beans.factory.aot.BeanRegistrationCode;
import org.springframework.beans.factory.support.RegisteredBean;

/**
* The seata properties bean registration AOT processor
*
* @author wang.liang
*/
class SeataPropertiesBeanRegistrationAotProcessor implements BeanRegistrationAotProcessor {

@Override
public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
if (ReflectionUtil.existsClass("io.seata.spring.boot.autoconfigure.StarterConstants")) {
Class<?> beanClass = registeredBean.getBeanClass();
if (StarterConstants.PROPERTY_BEAN_MAP.containsValue(beanClass)) {
return new SeataPropertiesBeanRegistrationAotContribution(beanClass);
}
}
return null;
}


/**
* The seata properties bean registration AOT contribution
*/
private static class SeataPropertiesBeanRegistrationAotContribution implements BeanRegistrationAotContribution {

private final Class<?> propertiesBeanClass;


public SeataPropertiesBeanRegistrationAotContribution(Class<?> propertiesBeanClass) {
this.propertiesBeanClass = propertiesBeanClass;
}


@Override
public void applyTo(GenerationContext generationContext, BeanRegistrationCode beanRegistrationCode) {
ReflectionHints reflectionHints = generationContext.getRuntimeHints().reflection();

// register the properties bean class
// See SpringBootConfigurationProvider#getDefaultValueFromPropertyObject(...)
AotUtils.registerType(reflectionHints, propertiesBeanClass, MemberCategory.DECLARED_FIELDS);
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.seata.spring.boot.autoconfigure.provider;

import java.lang.reflect.Field;
import java.lang.reflect.Proxy;
import java.time.Duration;
import java.util.Map;
import java.util.Objects;
Expand All @@ -32,8 +33,6 @@
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cglib.proxy.Enhancer;
import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.lang.Nullable;

Expand All @@ -60,8 +59,8 @@ public class SpringBootConfigurationProvider implements ExtConfigurationProvider

@Override
public Configuration provide(Configuration originalConfiguration) {
return (Configuration)Enhancer.create(originalConfiguration.getClass(),
(MethodInterceptor)(proxy, method, args, methodProxy) -> {
return (Configuration)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[]{Configuration.class}
, (proxy, method, args) -> {
if (method.getName().startsWith(INTERCEPT_METHOD_PREFIX) && args.length > 0) {
Object result;
String rawDataId = (String)args[0];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.springframework.beans.factory.aot.BeanRegistrationAotProcessor=\
io.seata.spring.aot.SeataPropertiesBeanRegistrationAotProcessor
Loading