From c65f40dacdabc5f3a43936082e559cd2e5fa90a6 Mon Sep 17 00:00:00 2001 From: yuluo-yx Date: Thu, 1 Aug 2024 11:02:02 +0800 Subject: [PATCH 1/8] fix Signed-off-by: yuluo-yx --- .../RocketMQPollableConsumeApplication.java | 5 --- .../src/main/resources/application.yml | 3 ++ ...gHandlerMappingsProviderConfiguration.java | 13 ++++++ .../RocketMQBinderAutoConfiguration.java | 40 ++++++++++++------- ...RocketMQBinderConfigurationProperties.java | 12 +++++- .../RocketMQExtendedBindingProperties.java | 28 ++++++++++++- 6 files changed, 78 insertions(+), 23 deletions(-) diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/java/com/alibaba/cloud/examples/pollable/RocketMQPollableConsumeApplication.java b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/java/com/alibaba/cloud/examples/pollable/RocketMQPollableConsumeApplication.java index 51cadb5e89..a4dc525891 100644 --- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/java/com/alibaba/cloud/examples/pollable/RocketMQPollableConsumeApplication.java +++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/java/com/alibaba/cloud/examples/pollable/RocketMQPollableConsumeApplication.java @@ -21,8 +21,6 @@ import com.alibaba.cloud.examples.common.SimpleMsg; import org.apache.rocketmq.common.message.MessageConst; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationRunner; @@ -42,9 +40,6 @@ @SpringBootApplication public class RocketMQPollableConsumeApplication { - private static final Logger log = LoggerFactory - .getLogger(RocketMQPollableConsumeApplication.class); - @Autowired private StreamBridge streamBridge; diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml index 93523f5095..0ddd2933fe 100644 --- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml +++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml @@ -1,5 +1,6 @@ server: port: 28089 + spring: application: name: rocketmq-pollable-consume-example @@ -7,6 +8,7 @@ spring: stream: pollable-source: pollable rocketmq: + enabled: false binder: name-server: localhost:9876 bindings: @@ -18,6 +20,7 @@ spring: destination: pollable pollable-in-0: destination: pollable + logging: level: org.springframework.context.support: debug diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/ExtendedBindingHandlerMappingsProviderConfiguration.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/ExtendedBindingHandlerMappingsProviderConfiguration.java index f51631b4f8..bba4193ca5 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/ExtendedBindingHandlerMappingsProviderConfiguration.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/ExtendedBindingHandlerMappingsProviderConfiguration.java @@ -21,8 +21,10 @@ import com.alibaba.cloud.stream.binder.rocketmq.convert.RocketMQMessageConverter; import com.alibaba.cloud.stream.binder.rocketmq.custom.RocketMQConfigBeanPostProcessor; +import com.alibaba.cloud.stream.binder.rocketmq.properties.RocketMQExtendedBindingProperties; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.source.ConfigurationPropertyName; import org.springframework.cloud.stream.config.BindingHandlerAdvise.MappingsProvider; import org.springframework.context.annotation.Bean; @@ -31,10 +33,17 @@ import org.springframework.messaging.converter.MessageConverter; @Configuration +@ConditionalOnProperty( + prefix = RocketMQExtendedBindingProperties.PREFIX, + name = "enabled", + havingValue = "true", + matchIfMissing = true +) public class ExtendedBindingHandlerMappingsProviderConfiguration { @Bean public MappingsProvider rocketExtendedPropertiesDefaultMappingsProvider() { + return () -> { Map mappings = new HashMap<>(); mappings.put( @@ -44,12 +53,14 @@ public MappingsProvider rocketExtendedPropertiesDefaultMappingsProvider() { ConfigurationPropertyName.of("spring.cloud.stream.rocketmq.streams"), ConfigurationPropertyName .of("spring.cloud.stream.rocketmq.streams.default")); + return mappings; }; } @Bean public static RocketMQConfigBeanPostProcessor rocketMQConfigBeanPostProcessor() { + return new RocketMQConfigBeanPostProcessor(); } @@ -60,6 +71,7 @@ public static RocketMQConfigBeanPostProcessor rocketMQConfigBeanPostProcessor() @Bean(RocketMQMessageConverter.DEFAULT_NAME) @ConditionalOnMissingBean(name = { RocketMQMessageConverter.DEFAULT_NAME }) public CompositeMessageConverter rocketMQMessageConverter() { + return new RocketMQMessageConverter().getMessageConverter(); } @@ -70,6 +82,7 @@ public CompositeMessageConverter rocketMQMessageConverter() { */ @Bean public MessageConverter rocketMQCustomMessageConverter() { + return new RocketMQMessageConverter(); } diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java index 9a665867c2..7614c09172 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java @@ -22,13 +22,13 @@ import com.alibaba.cloud.stream.binder.rocketmq.properties.RocketMQExtendedBindingProperties; import com.alibaba.cloud.stream.binder.rocketmq.provisioning.RocketMQTopicProvisioner; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; import org.springframework.boot.actuate.health.HealthIndicator; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; /** * issue:https://github.com/alibaba/spring-cloud-alibaba/issues/1681 . @@ -37,36 +37,46 @@ * @author Jim * @author freeman */ -@Configuration(proxyBeanMethods = false) -@EnableConfigurationProperties({ RocketMQExtendedBindingProperties.class, - RocketMQBinderConfigurationProperties.class }) -public class RocketMQBinderAutoConfiguration { - - @Autowired - private RocketMQExtendedBindingProperties extendedBindingProperties; - @Autowired - private RocketMQBinderConfigurationProperties rocketBinderConfigurationProperties; +@AutoConfiguration +@EnableConfigurationProperties({ + RocketMQExtendedBindingProperties.class, + RocketMQBinderConfigurationProperties.class +}) +public class RocketMQBinderAutoConfiguration { @Bean public RocketMQTopicProvisioner rocketMQTopicProvisioner() { + return new RocketMQTopicProvisioner(); } @Bean public RocketMQMessageChannelBinder rocketMQMessageChannelBinder( - RocketMQTopicProvisioner provisioningProvider) { - return new RocketMQMessageChannelBinder(rocketBinderConfigurationProperties, - extendedBindingProperties, provisioningProvider); + RocketMQTopicProvisioner provisioningProvider, + RocketMQExtendedBindingProperties extendedBindingProperties, + RocketMQBinderConfigurationProperties rocketBinderConfigurationProperties + ) { + + return new RocketMQMessageChannelBinder( + rocketBinderConfigurationProperties, + extendedBindingProperties, provisioningProvider + ); } - @Configuration(proxyBeanMethods = false) @ConditionalOnClass(HealthIndicator.class) @ConditionalOnEnabledHealthIndicator("rocketmq") + @ConditionalOnProperty( + prefix = RocketMQExtendedBindingProperties.PREFIX, + name = "enabled", + havingValue = "true", + matchIfMissing = true + ) static class RocketMQBinderHealthIndicatorConfiguration { @Bean public RocketMQBinderHealthIndicator rocketMQBinderHealthIndicator() { + return new RocketMQBinderHealthIndicator(); } diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java index 0f36718584..a4eb394000 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java @@ -16,6 +16,7 @@ package com.alibaba.cloud.stream.binder.rocketmq.properties; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.ConfigurationProperties; /** @@ -23,7 +24,16 @@ * * @author Jim */ -@ConfigurationProperties(prefix = "spring.cloud.stream.rocketmq.binder") + +@ConfigurationProperties(prefix = RocketMQBinderConfigurationProperties.PREFIX) +@ConditionalOnProperty( + prefix = RocketMQBinderConfigurationProperties.PREFIX, + name = "enabled", + havingValue = "true", + matchIfMissing = true +) public class RocketMQBinderConfigurationProperties extends RocketMQCommonProperties { + public static final String PREFIX = "spring.cloud.stream.rocketmq.binder"; + } diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQExtendedBindingProperties.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQExtendedBindingProperties.java index b96876837b..d522065b2b 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQExtendedBindingProperties.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQExtendedBindingProperties.java @@ -26,11 +26,35 @@ * * @author Jim */ -@ConfigurationProperties("spring.cloud.stream.rocketmq") +@ConfigurationProperties(RocketMQExtendedBindingProperties.PREFIX) public class RocketMQExtendedBindingProperties extends AbstractExtendedBindingProperties { - private static final String DEFAULTS_PREFIX = "spring.cloud.stream.rocketmq.default"; + /** + * Public constant for the RocketMQ binder name. + */ + public static final String PREFIX = "spring.cloud.stream.rocketmq"; + + /** + * Default prefix for rocketmq binder properties. + */ + private static final String DEFAULTS_PREFIX = PREFIX + ".default"; + + /** + * Rocketmq bean autoconfiguration flags. + */ + private boolean enabled = true; + + public boolean isEnabled() { + + return this.enabled; + } + + public void setEnabled(boolean enabled) { + + this.enabled = enabled; + System.out.println("shuchudfsdgagf " + enabled); + } @Override public String getDefaultsPrefix() { From 6c793fdd4ae88d0e60d4911c9c9f76420da463b4 Mon Sep 17 00:00:00 2001 From: yuluo-yx Date: Mon, 5 Aug 2024 22:52:21 +0800 Subject: [PATCH 2/8] chore: convert properties config file type to yml type Signed-off-by: yuluo-yx --- .../src/main/resources/application.properties | 24 ---------- .../src/main/resources/application.yml | 44 +++++++++++++++++++ .../src/main/resources/application.properties | 24 ---------- .../src/main/resources/application.yml | 44 +++++++++++++++++++ .../cloud/examples/EchoController.java | 1 - .../src/main/resources/application.properties | 16 ------- .../src/main/resources/application.yml | 26 +++++++++++ .../src/main/resources/application.properties | 9 ---- .../src/main/resources/application.yml | 22 ++++++++++ .../src/main/resources/application.properties | 15 ------- .../src/main/resources/application.yml | 28 ++++++++++++ .../src/main/resources/application.properties | 8 ---- .../src/main/resources/application.yml | 19 ++++++++ 13 files changed, 183 insertions(+), 97 deletions(-) delete mode 100644 spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/application.properties create mode 100644 spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/application.yml delete mode 100644 spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-sclb-example/src/main/resources/application.properties create mode 100644 spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-sclb-example/src/main/resources/application.yml delete mode 100755 spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/resources/application.properties create mode 100644 spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/resources/application.yml delete mode 100644 spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/resources/application.properties create mode 100644 spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/resources/application.yml delete mode 100644 spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/resources/application.properties create mode 100644 spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/resources/application.yml delete mode 100644 spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/resources/application.properties create mode 100644 spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/resources/application.yml diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/application.properties deleted file mode 100644 index 54c41e2772..0000000000 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/application.properties +++ /dev/null @@ -1,24 +0,0 @@ -spring.application.name=service-consumer -server.port=18083 -management.endpoints.web.exposure.include=* -spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 -spring.cloud.nacos.discovery.fail-fast=true - -spring.cloud.nacos.username=nacos -spring.cloud.nacos.password=nacos - -feign.sentinel.enabled=true - -spring.cloud.sentinel.transport.dashboard=localhost:8080 -spring.cloud.sentinel.eager=true - -spring.cloud.sentinel.datasource.ds1.file.file=classpath: flowrule.json -spring.cloud.sentinel.datasource.ds1.file.data-type=json -spring.cloud.sentinel.datasource.ds1.file.rule-type=flow - -spring.cloud.sentinel.datasource.ds2.file.file=classpath: degraderule.json -spring.cloud.sentinel.datasource.ds2.file.data-type=json -spring.cloud.sentinel.datasource.ds2.file.rule-type=degrade -spring.cloud.loadbalancer.nacos.enabled=true -# use feign client in GraalVM environment need to set below config -spring.cloud.refresh.enabled=false diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/application.yml b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/application.yml new file mode 100644 index 0000000000..f1f60174b6 --- /dev/null +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/application.yml @@ -0,0 +1,44 @@ +spring: + application: + name: service-consumer + + cloud: + # use feign client in GraalVM environment need to set below config + refresh: + enabled: true + nacos: + discovery: + username: 'nacos' + password: 'nacos' + server-addr: 127.0.0.1:8848 + fail-fast: true + + sentinel: + transport: + dashboard: localhost:8080 + eager: true + datasource: + ds1: + file: + file: classpath:flowrule.json + data-type: json + rule-type: flow + ds2: + file: + file: classpath:degraderule.json + data-type: json + rule-type: degrade + +server: + port: 18083 + +management: + endpoints: + web: + exposure: + include: * + + +feign: + sentinel: + enabled: true diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-sclb-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-sclb-example/src/main/resources/application.properties deleted file mode 100644 index b695d17637..0000000000 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-sclb-example/src/main/resources/application.properties +++ /dev/null @@ -1,24 +0,0 @@ -spring.application.name=service-consumer-sclb -server.port=18083 -management.endpoints.web.exposure.include=* -spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 - -spring.cloud.nacos.username=nacos -spring.cloud.nacos.password=nacos - -spring.cloud.loadbalancer.ribbon.enabled=false -spring.cloud.loadbalancer.configurations=zone-preference -spring.cloud.loadbalancer.zone=hangzhou - -feign.sentinel.enabled=true - -spring.cloud.sentinel.transport.dashboard=localhost:8080 -spring.cloud.sentinel.eager=true - -spring.cloud.sentinel.datasource.ds1.file.file=classpath: flowrule.json -spring.cloud.sentinel.datasource.ds1.file.data-type=json -spring.cloud.sentinel.datasource.ds1.file.rule-type=flow - -spring.cloud.sentinel.datasource.ds2.file.file=classpath: degraderule.json -spring.cloud.sentinel.datasource.ds2.file.data-type=json -spring.cloud.sentinel.datasource.ds2.file.rule-type=degrade diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-sclb-example/src/main/resources/application.yml b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-sclb-example/src/main/resources/application.yml new file mode 100644 index 0000000000..05d52fe06a --- /dev/null +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-sclb-example/src/main/resources/application.yml @@ -0,0 +1,44 @@ +spring: + application: + name: service-consumer-sclb + + cloud: + nacos: + discovery: + server-addr: 127.0.0.1:8848 + username: nacos + password: nacos + loadbalancer: + ribbon: + enabled: false + configurations: zone-preference + zone: hangzhou + + sentinel: + transport: + dashboard: localhost:8080 + eager: true + datasource: + ds1: + file: + file: classpath:flowrule.json + data-type: json + rule-type: flow + ds2: + file: + file: classpath:degraderule.json + data-type: json + rule-type: degrade + +feign: + sentinel: + enabled: true + +server: + port: 18083 + +management: + endpoints: + web: + exposure: + include: '*' diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/java/com/alibaba/cloud/examples/EchoController.java b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/java/com/alibaba/cloud/examples/EchoController.java index 93d824800b..312a2be9ae 100644 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/java/com/alibaba/cloud/examples/EchoController.java +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/java/com/alibaba/cloud/examples/EchoController.java @@ -18,7 +18,6 @@ import java.util.Map; - import com.alibaba.cloud.nacos.NacosDiscoveryProperties; import jakarta.annotation.Resource; diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/resources/application.properties deleted file mode 100755 index af358409dc..0000000000 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/resources/application.properties +++ /dev/null @@ -1,16 +0,0 @@ -server.port=0 -spring.application.name=service-provider -spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 -spring.cloud.nacos.discovery.enabled=true -#spring.cloud.nacos.discovery.instance-enabled=true -#only register IPv4 instance -#spring.cloud.nacos.discovery.ip-type=IPv4 -#only register IPv6 instance -#spring.cloud.nacos.discovery.ip-type=IPv6 - -spring.cloud.nacos.username=nacos -spring.cloud.nacos.password=nacos - -management.endpoints.web.exposure.include=* -management.endpoint.health.show-details=always - diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/resources/application.yml b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/resources/application.yml new file mode 100644 index 0000000000..af39bba364 --- /dev/null +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/resources/application.yml @@ -0,0 +1,26 @@ +spring: + application: + name: service-provider + + cloud: + nacos: + discovery: + server-addr: 127.0.0.1:8848 + enabled: true + # instance-enabled: true + # ip-type: IPv4 # only register IPv4 instance + # ip-type: IPv6 # only register IPv6 instance + username: nacos + password: nacos + +server: + port: 0 + +management: + endpoints: + web: + exposure: + include: '*' + endpoint: + health: + show-details: always diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/resources/application.properties deleted file mode 100644 index 4cdd63be6e..0000000000 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/resources/application.properties +++ /dev/null @@ -1,9 +0,0 @@ -spring.application.name=service-consumer-reactive -server.port=18083 -management.endpoints.web.exposure.include=* -spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 - -spring.cloud.nacos.username=nacos -spring.cloud.nacos.password=nacos - -spring.cloud.loadbalancer.ribbon.enabled=false diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/resources/application.yml b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/resources/application.yml new file mode 100644 index 0000000000..d4b4bbb5c8 --- /dev/null +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-reactivediscovery-consumer-example/src/main/resources/application.yml @@ -0,0 +1,22 @@ +spring: + application: + name: service-consumer-reactive + + cloud: + nacos: + discovery: + server-addr: 127.0.0.1:8848 + username: nacos + password: nacos + loadbalancer: + ribbon: + enabled: false + +server: + port: 18083 + +management: + endpoints: + web: + exposure: + include: '*' diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/resources/application.properties deleted file mode 100644 index b2e3f9ef1d..0000000000 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/resources/application.properties +++ /dev/null @@ -1,15 +0,0 @@ -server.port=18085 -spring.application.name=service-gateway -spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 - -spring.cloud.nacos.username=nacos -spring.cloud.nacos.password=nacos - -management.endpoints.web.exposure.include=* - -# spring cloud route config -spring.cloud.gateway.routes[0].id=nacos-route -spring.cloud.gateway.routes[0].uri=lb://service-gateway-provider -spring.cloud.gateway.routes[0].predicates[0].name=Path -spring.cloud.gateway.routes[0].predicates[0].args[pattern]=/nacos/** -spring.cloud.gateway.routes[0].filters[0]=StripPrefix=1 diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/resources/application.yml b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/resources/application.yml new file mode 100644 index 0000000000..5b0c87c6b4 --- /dev/null +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/resources/application.yml @@ -0,0 +1,28 @@ +spring: + application: + name: service-gateway + + cloud: + nacos: + discovery: + server-addr: 127.0.0.1:8848 + username: nacos + password: nacos + + gateway: + routes: + - id: nacos-route + uri: lb://service-gateway-provider + predicates: + - Path=/nacos/** + filters: + - StripPrefix=1 + +server: + port: 18085 + +management: + endpoints: + web: + exposure: + include: '*' diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/resources/application.properties deleted file mode 100644 index bda46189e7..0000000000 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/resources/application.properties +++ /dev/null @@ -1,8 +0,0 @@ -server.port=18086 -spring.application.name=service-gateway-provider -spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 - -spring.cloud.nacos.username=nacos -spring.cloud.nacos.password=nacos - -management.endpoints.web.exposure.include=* diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/resources/application.yml b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/resources/application.yml new file mode 100644 index 0000000000..ab86093d1e --- /dev/null +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/resources/application.yml @@ -0,0 +1,19 @@ +spring: + application: + name: service-gateway-provider + + cloud: + nacos: + discovery: + server-addr: 127.0.0.1:8848 + username: nacos + password: nacos + +server: + port: 18086 + +management: + endpoints: + web: + exposure: + include: '*' From 5f27e0c2fa1e943cc57c32ed84e6c0f237b407c2 Mon Sep 17 00:00:00 2001 From: yuluo-yx Date: Mon, 5 Aug 2024 22:55:57 +0800 Subject: [PATCH 3/8] fix Signed-off-by: yuluo-yx --- .../pollable/RocketMQPollableConsumeApplication.java | 5 +++++ .../src/main/resources/application.yml | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/java/com/alibaba/cloud/examples/pollable/RocketMQPollableConsumeApplication.java b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/java/com/alibaba/cloud/examples/pollable/RocketMQPollableConsumeApplication.java index a4dc525891..51cadb5e89 100644 --- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/java/com/alibaba/cloud/examples/pollable/RocketMQPollableConsumeApplication.java +++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/java/com/alibaba/cloud/examples/pollable/RocketMQPollableConsumeApplication.java @@ -21,6 +21,8 @@ import com.alibaba.cloud.examples.common.SimpleMsg; import org.apache.rocketmq.common.message.MessageConst; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationRunner; @@ -40,6 +42,9 @@ @SpringBootApplication public class RocketMQPollableConsumeApplication { + private static final Logger log = LoggerFactory + .getLogger(RocketMQPollableConsumeApplication.class); + @Autowired private StreamBridge streamBridge; diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml index 0ddd2933fe..a44f5c534f 100644 --- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml +++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml @@ -8,7 +8,6 @@ spring: stream: pollable-source: pollable rocketmq: - enabled: false binder: name-server: localhost:9876 bindings: From 1ee2bcd9b07c56ab56ea2cdaa4ea70845fa4729e Mon Sep 17 00:00:00 2001 From: yuluo-yx Date: Mon, 5 Aug 2024 22:58:39 +0800 Subject: [PATCH 4/8] fix Signed-off-by: yuluo-yx --- .../src/main/resources/application.yml | 1 - ...gHandlerMappingsProviderConfiguration.java | 8 ----- .../RocketMQBinderAutoConfiguration.java | 32 +++++++++---------- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml index a44f5c534f..ebe966f518 100644 --- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml +++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml @@ -19,7 +19,6 @@ spring: destination: pollable pollable-in-0: destination: pollable - logging: level: org.springframework.context.support: debug diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/ExtendedBindingHandlerMappingsProviderConfiguration.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/ExtendedBindingHandlerMappingsProviderConfiguration.java index bba4193ca5..c274e8637e 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/ExtendedBindingHandlerMappingsProviderConfiguration.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/ExtendedBindingHandlerMappingsProviderConfiguration.java @@ -21,10 +21,8 @@ import com.alibaba.cloud.stream.binder.rocketmq.convert.RocketMQMessageConverter; import com.alibaba.cloud.stream.binder.rocketmq.custom.RocketMQConfigBeanPostProcessor; -import com.alibaba.cloud.stream.binder.rocketmq.properties.RocketMQExtendedBindingProperties; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.source.ConfigurationPropertyName; import org.springframework.cloud.stream.config.BindingHandlerAdvise.MappingsProvider; import org.springframework.context.annotation.Bean; @@ -33,12 +31,6 @@ import org.springframework.messaging.converter.MessageConverter; @Configuration -@ConditionalOnProperty( - prefix = RocketMQExtendedBindingProperties.PREFIX, - name = "enabled", - havingValue = "true", - matchIfMissing = true -) public class ExtendedBindingHandlerMappingsProviderConfiguration { @Bean diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java index 7614c09172..8b46e5010a 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java @@ -22,13 +22,13 @@ import com.alibaba.cloud.stream.binder.rocketmq.properties.RocketMQExtendedBindingProperties; import com.alibaba.cloud.stream.binder.rocketmq.provisioning.RocketMQTopicProvisioner; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; import org.springframework.boot.actuate.health.HealthIndicator; -import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; /** * issue:https://github.com/alibaba/spring-cloud-alibaba/issues/1681 . @@ -38,17 +38,22 @@ * @author freeman */ -@AutoConfiguration -@EnableConfigurationProperties({ - RocketMQExtendedBindingProperties.class, - RocketMQBinderConfigurationProperties.class -}) +@Configuration(proxyBeanMethods = false) +@EnableConfigurationProperties({ RocketMQExtendedBindingProperties.class, + RocketMQBinderConfigurationProperties.class }) public class RocketMQBinderAutoConfiguration { - @Bean - public RocketMQTopicProvisioner rocketMQTopicProvisioner() { + @Autowired + private RocketMQExtendedBindingProperties extendedBindingProperties; + + @Autowired + private RocketMQBinderConfigurationProperties rocketBinderConfigurationProperties; - return new RocketMQTopicProvisioner(); + @Bean + public RocketMQMessageChannelBinder rocketMQMessageChannelBinder( + RocketMQTopicProvisioner provisioningProvider) { + return new RocketMQMessageChannelBinder(rocketBinderConfigurationProperties, + extendedBindingProperties, provisioningProvider); } @Bean @@ -64,14 +69,9 @@ public RocketMQMessageChannelBinder rocketMQMessageChannelBinder( ); } + @Configuration(proxyBeanMethods = false) @ConditionalOnClass(HealthIndicator.class) @ConditionalOnEnabledHealthIndicator("rocketmq") - @ConditionalOnProperty( - prefix = RocketMQExtendedBindingProperties.PREFIX, - name = "enabled", - havingValue = "true", - matchIfMissing = true - ) static class RocketMQBinderHealthIndicatorConfiguration { @Bean From 8802299ba9a52bb37bf07e2d21e0fa7849457185 Mon Sep 17 00:00:00 2001 From: yuluo-yx Date: Mon, 5 Aug 2024 23:00:04 +0800 Subject: [PATCH 5/8] fix Signed-off-by: yuluo-yx --- .../src/main/resources/application.yml | 1 - .../ExtendedBindingHandlerMappingsProviderConfiguration.java | 5 ----- .../autoconfigurate/RocketMQBinderAutoConfiguration.java | 5 +++++ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml index ebe966f518..93523f5095 100644 --- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml +++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-pollable-consume-example/src/main/resources/application.yml @@ -1,6 +1,5 @@ server: port: 28089 - spring: application: name: rocketmq-pollable-consume-example diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/ExtendedBindingHandlerMappingsProviderConfiguration.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/ExtendedBindingHandlerMappingsProviderConfiguration.java index c274e8637e..f51631b4f8 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/ExtendedBindingHandlerMappingsProviderConfiguration.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/ExtendedBindingHandlerMappingsProviderConfiguration.java @@ -35,7 +35,6 @@ public class ExtendedBindingHandlerMappingsProviderConfiguration { @Bean public MappingsProvider rocketExtendedPropertiesDefaultMappingsProvider() { - return () -> { Map mappings = new HashMap<>(); mappings.put( @@ -45,14 +44,12 @@ public MappingsProvider rocketExtendedPropertiesDefaultMappingsProvider() { ConfigurationPropertyName.of("spring.cloud.stream.rocketmq.streams"), ConfigurationPropertyName .of("spring.cloud.stream.rocketmq.streams.default")); - return mappings; }; } @Bean public static RocketMQConfigBeanPostProcessor rocketMQConfigBeanPostProcessor() { - return new RocketMQConfigBeanPostProcessor(); } @@ -63,7 +60,6 @@ public static RocketMQConfigBeanPostProcessor rocketMQConfigBeanPostProcessor() @Bean(RocketMQMessageConverter.DEFAULT_NAME) @ConditionalOnMissingBean(name = { RocketMQMessageConverter.DEFAULT_NAME }) public CompositeMessageConverter rocketMQMessageConverter() { - return new RocketMQMessageConverter().getMessageConverter(); } @@ -74,7 +70,6 @@ public CompositeMessageConverter rocketMQMessageConverter() { */ @Bean public MessageConverter rocketMQCustomMessageConverter() { - return new RocketMQMessageConverter(); } diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java index 8b46e5010a..d6467d29dd 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java @@ -49,6 +49,11 @@ public class RocketMQBinderAutoConfiguration { @Autowired private RocketMQBinderConfigurationProperties rocketBinderConfigurationProperties; + @Bean + public RocketMQTopicProvisioner rocketMQTopicProvisioner() { + return new RocketMQTopicProvisioner(); + } + @Bean public RocketMQMessageChannelBinder rocketMQMessageChannelBinder( RocketMQTopicProvisioner provisioningProvider) { From 5d8f4bb76daf7e24b5d34f36eb43545b46ca578f Mon Sep 17 00:00:00 2001 From: yuluo-yx Date: Mon, 5 Aug 2024 23:02:30 +0800 Subject: [PATCH 6/8] fix Signed-off-by: yuluo-yx --- .../RocketMQBinderAutoConfiguration.java | 14 ---------- ...RocketMQBinderConfigurationProperties.java | 9 +----- .../RocketMQExtendedBindingProperties.java | 28 ++----------------- 3 files changed, 3 insertions(+), 48 deletions(-) diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java index d6467d29dd..adbe13540b 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java @@ -61,19 +61,6 @@ public RocketMQMessageChannelBinder rocketMQMessageChannelBinder( extendedBindingProperties, provisioningProvider); } - @Bean - public RocketMQMessageChannelBinder rocketMQMessageChannelBinder( - RocketMQTopicProvisioner provisioningProvider, - RocketMQExtendedBindingProperties extendedBindingProperties, - RocketMQBinderConfigurationProperties rocketBinderConfigurationProperties - ) { - - return new RocketMQMessageChannelBinder( - rocketBinderConfigurationProperties, - extendedBindingProperties, provisioningProvider - ); - } - @Configuration(proxyBeanMethods = false) @ConditionalOnClass(HealthIndicator.class) @ConditionalOnEnabledHealthIndicator("rocketmq") @@ -81,7 +68,6 @@ static class RocketMQBinderHealthIndicatorConfiguration { @Bean public RocketMQBinderHealthIndicator rocketMQBinderHealthIndicator() { - return new RocketMQBinderHealthIndicator(); } diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java index a4eb394000..396164fd80 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java @@ -16,7 +16,6 @@ package com.alibaba.cloud.stream.binder.rocketmq.properties; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.ConfigurationProperties; /** @@ -25,13 +24,7 @@ * @author Jim */ -@ConfigurationProperties(prefix = RocketMQBinderConfigurationProperties.PREFIX) -@ConditionalOnProperty( - prefix = RocketMQBinderConfigurationProperties.PREFIX, - name = "enabled", - havingValue = "true", - matchIfMissing = true -) +@ConfigurationProperties(prefix = "spring.cloud.stream.rocketmq.binder") public class RocketMQBinderConfigurationProperties extends RocketMQCommonProperties { public static final String PREFIX = "spring.cloud.stream.rocketmq.binder"; diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQExtendedBindingProperties.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQExtendedBindingProperties.java index d522065b2b..b96876837b 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQExtendedBindingProperties.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQExtendedBindingProperties.java @@ -26,35 +26,11 @@ * * @author Jim */ -@ConfigurationProperties(RocketMQExtendedBindingProperties.PREFIX) +@ConfigurationProperties("spring.cloud.stream.rocketmq") public class RocketMQExtendedBindingProperties extends AbstractExtendedBindingProperties { - /** - * Public constant for the RocketMQ binder name. - */ - public static final String PREFIX = "spring.cloud.stream.rocketmq"; - - /** - * Default prefix for rocketmq binder properties. - */ - private static final String DEFAULTS_PREFIX = PREFIX + ".default"; - - /** - * Rocketmq bean autoconfiguration flags. - */ - private boolean enabled = true; - - public boolean isEnabled() { - - return this.enabled; - } - - public void setEnabled(boolean enabled) { - - this.enabled = enabled; - System.out.println("shuchudfsdgagf " + enabled); - } + private static final String DEFAULTS_PREFIX = "spring.cloud.stream.rocketmq.default"; @Override public String getDefaultsPrefix() { From cf28a762fe4df0abfdd1705d03de595954555cb7 Mon Sep 17 00:00:00 2001 From: yuluo-yx Date: Mon, 5 Aug 2024 23:03:30 +0800 Subject: [PATCH 7/8] fix Signed-off-by: yuluo-yx --- .../autoconfigurate/RocketMQBinderAutoConfiguration.java | 1 - .../properties/RocketMQBinderConfigurationProperties.java | 2 -- 2 files changed, 3 deletions(-) diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java index adbe13540b..9a665867c2 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/autoconfigurate/RocketMQBinderAutoConfiguration.java @@ -37,7 +37,6 @@ * @author Jim * @author freeman */ - @Configuration(proxyBeanMethods = false) @EnableConfigurationProperties({ RocketMQExtendedBindingProperties.class, RocketMQBinderConfigurationProperties.class }) diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java index 396164fd80..298ffe120f 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java @@ -23,10 +23,8 @@ * * @author Jim */ - @ConfigurationProperties(prefix = "spring.cloud.stream.rocketmq.binder") public class RocketMQBinderConfigurationProperties extends RocketMQCommonProperties { public static final String PREFIX = "spring.cloud.stream.rocketmq.binder"; - } From 00310fa27675b4549a7f69ceac0bfb81097a9b5e Mon Sep 17 00:00:00 2001 From: yuluo-yx Date: Mon, 5 Aug 2024 23:04:05 +0800 Subject: [PATCH 8/8] fix Signed-off-by: yuluo-yx --- .../properties/RocketMQBinderConfigurationProperties.java | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java index 298ffe120f..0f36718584 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/properties/RocketMQBinderConfigurationProperties.java @@ -26,5 +26,4 @@ @ConfigurationProperties(prefix = "spring.cloud.stream.rocketmq.binder") public class RocketMQBinderConfigurationProperties extends RocketMQCommonProperties { - public static final String PREFIX = "spring.cloud.stream.rocketmq.binder"; }