Skip to content

Commit 2b6bbd3

Browse files
author
panzhi33
committed
[ISSUE #674] 修复validate
1 parent afe909e commit 2b6bbd3

File tree

4 files changed

+0
-37
lines changed

4 files changed

+0
-37
lines changed

rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/ExtConsumerResetConfiguration.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ private void registerTemplate(String beanName, Object bean) {
8787
}
8888

8989
ExtRocketMQConsumerConfiguration annotation = clazz.getAnnotation(ExtRocketMQConsumerConfiguration.class);
90-
GenericApplicationContext genericApplicationContext = (GenericApplicationContext) applicationContext;
91-
validate(annotation, genericApplicationContext);
9290

9391
DefaultLitePullConsumer consumer = null;
9492
try {
@@ -142,14 +140,4 @@ private String resolvePlaceholders(String text, String defaultValue) {
142140
String value = environment.resolvePlaceholders(text);
143141
return StringUtils.hasLength(value) ? value : defaultValue;
144142
}
145-
146-
private void validate(ExtRocketMQConsumerConfiguration annotation,
147-
GenericApplicationContext genericApplicationContext) {
148-
if (genericApplicationContext.isBeanNameInUse(annotation.value())) {
149-
throw new BeanDefinitionValidationException(
150-
String.format("Bean {} has been used in Spring Application Context, " +
151-
"please check the @ExtRocketMQConsumerConfiguration",
152-
annotation.value()));
153-
}
154-
}
155143
}

rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/ExtProducerResetConfiguration.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ private void registerTemplate(String beanName, Object bean) {
8181
}
8282

8383
ExtRocketMQTemplateConfiguration annotation = clazz.getAnnotation(ExtRocketMQTemplateConfiguration.class);
84-
GenericApplicationContext genericApplicationContext = (GenericApplicationContext) applicationContext;
85-
validate(annotation, genericApplicationContext);
8684

8785
DefaultMQProducer mqProducer = createProducer(annotation);
8886
try {

rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/autoconfigure/ExtConsumerResetConfiguration.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ private void registerTemplate(String beanName, Object bean) {
8787
throw new IllegalStateException(clazz + " is not instance of " + RocketMQClientTemplate.class.getName());
8888
}
8989
org.apache.rocketmq.client.annotation.ExtConsumerResetConfiguration annotation = clazz.getAnnotation(org.apache.rocketmq.client.annotation.ExtConsumerResetConfiguration.class);
90-
GenericApplicationContext genericApplicationContext = (GenericApplicationContext) applicationContext;
91-
validate(annotation, genericApplicationContext);
9290

9391
SimpleConsumerBuilder consumerBuilder = null;
9492
SimpleConsumer simpleConsumer = null;
@@ -145,16 +143,6 @@ private String resolvePlaceholders(String text, String defaultValue) {
145143
return StringUtils.hasLength(value) ? value : defaultValue;
146144
}
147145

148-
private void validate(org.apache.rocketmq.client.annotation.ExtConsumerResetConfiguration annotation,
149-
GenericApplicationContext genericApplicationContext) {
150-
if (genericApplicationContext.isBeanNameInUse(annotation.value())) {
151-
throw new BeanDefinitionValidationException(
152-
String.format("Bean %s has been used in Spring Application Context, " +
153-
"please check the @ExtRocketMQConsumerConfiguration",
154-
annotation.value()));
155-
}
156-
}
157-
158146
static class SimpleConsumerInfo {
159147
String consumerGroup;
160148

rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/autoconfigure/ExtTemplateResetConfiguration.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ private void registerTemplate(String beanName, Object bean) {
8787
}
8888

8989
ExtProducerResetConfiguration annotation = clazz.getAnnotation(ExtProducerResetConfiguration.class);
90-
GenericApplicationContext genericApplicationContext = (GenericApplicationContext) applicationContext;
91-
validate(annotation, genericApplicationContext);
9290

9391
ProducerBuilder producerBuilder = createProducer(annotation);
9492
RocketMQClientTemplate rocketMQTemplate = (RocketMQClientTemplate) bean;
@@ -124,13 +122,4 @@ private ProducerBuilder createProducer(ExtProducerResetConfiguration annotation)
124122
return producerBuilder;
125123
}
126124

127-
private void validate(ExtProducerResetConfiguration annotation,
128-
GenericApplicationContext genericApplicationContext) {
129-
if (genericApplicationContext.isBeanNameInUse(annotation.value())) {
130-
throw new BeanDefinitionValidationException(String.format("Bean %s has been used in Spring Application Context, " +
131-
"please check the @ExtTemplateConfiguration",
132-
annotation.value()));
133-
}
134-
}
135-
136125
}

0 commit comments

Comments
 (0)