Skip to content

Commit 244de0f

Browse files
committed
Rabbit biner AOT/native runtime hints
* Add missing native runtime hints for the Rabbit binder properties classes Resolves #2938
1 parent 0e2954c commit 244de0f

File tree

4 files changed

+60
-3
lines changed

4 files changed

+60
-3
lines changed

binders/kafka-binder/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/aot/KafkaBinderRuntimeHints.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2023 the original author or authors.
2+
* Copyright 2023-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@
3636
*
3737
*/
3838
public class KafkaBinderRuntimeHints implements RuntimeHintsRegistrar {
39+
3940
@Override
4041
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
4142
ReflectionHints reflectionHints = hints.reflection();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2024-2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.cloud.stream.binder.rabbit.aot;
18+
19+
import java.util.stream.Stream;
20+
21+
import org.springframework.aot.hint.MemberCategory;
22+
import org.springframework.aot.hint.ReflectionHints;
23+
import org.springframework.aot.hint.RuntimeHints;
24+
import org.springframework.aot.hint.RuntimeHintsRegistrar;
25+
import org.springframework.cloud.stream.binder.rabbit.properties.RabbitBindingProperties;
26+
import org.springframework.cloud.stream.binder.rabbit.properties.RabbitCommonProperties;
27+
import org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties;
28+
import org.springframework.cloud.stream.binder.rabbit.properties.RabbitExtendedBindingProperties;
29+
import org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties;
30+
import org.springframework.lang.Nullable;
31+
32+
/**
33+
* {@link RuntimeHintsRegistrar} for the Rabbit binder in Spring Cloud Stream.
34+
*
35+
* @author Soby Chacko
36+
* @since 4.1.2
37+
*
38+
*/
39+
public class RabbitBinderRuntimeHints implements RuntimeHintsRegistrar {
40+
41+
@Override
42+
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
43+
ReflectionHints reflectionHints = hints.reflection();
44+
Stream.of(
45+
RabbitCommonProperties.class,
46+
RabbitConsumerProperties.class,
47+
RabbitProducerProperties.class,
48+
RabbitExtendedBindingProperties.class,
49+
RabbitBindingProperties.class)
50+
.forEach(type -> reflectionHints.registerType(type,
51+
builder -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
52+
MemberCategory.INVOKE_DECLARED_METHODS,
53+
MemberCategory.INTROSPECT_PUBLIC_METHODS)));
54+
}
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.springframework.aot.hint.RuntimeHintsRegistrar=org.springframework.cloud.stream.binder.rabbit.aot.RabbitBinderRuntimeHints

buildRabbitBinder.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ if [ "$#" -eq 1 ]; then
44
ARGVALUE=$1
55
if [[ $ARGVALUE == *"skipTest"* ]]; then
66
echo "Skippping Tests"
7-
./mvnw clean install -f core/pom.xml -DskipTests
7+
./mvnw clean install -f binders/rabbit-binder/pom.xml -DskipTests
88
elif [[ $ARGVALUE == *"disable.checks"* ]]; then
99
echo "Skippping checkstyle checks"
10-
./mvnw clean install -f core/pom.xml -Ddisable.checks=true
10+
./mvnw clean install -f binders/rabbit-binder/pom.xml -Ddisable.checks=true
1111
fi
1212
else
1313
./mvnw clean install -f binders/rabbit-binder/pom.xml

0 commit comments

Comments
 (0)