We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
环境 dubbo-2.7.0 dubbo-spring-boot-starter-2.7.0
同时使用xml作为dubbo的配置时,会出现以下异常:
dubbo
Caused by: java.lang.IllegalStateException: Duplicate application configs: <dubbo:application name="dubbo-consumer-2.7.x" valid="true" id="dubbo-consumer-2.7.x" prefix="dubbo.application" /> and <dubbo:application valid="false" prefix="dubbo.application" />
@SpringBootApplication( exclude = { DataSourceAutoConfiguration.class, WebSocketServletAutoConfiguration.class, JmxAutoConfiguration.class } ) @ImportResource(locations = {"classpath:dubbo.xml"}) @Slf4j public class DubboConsumer270 { public static void main(String[] args) { SpringApplication.run(DubboConsumer270.class, args); } }
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://dubbo.apache.org/schema/dubbo" xmlns="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"> <dubbo:application name="dubbo-consumer-2.7.x"> <dubbo:parameter key="qos.enable" value="false"/> </dubbo:application> <dubbo:registry address="zookeeper://192.168.56.101:2181" client="curator"/> <dubbo:consumer check="false" client="netty"/> <dubbo:reference id="dubboService" interface="top.ylonline.dubbo27x.api.DubboService"/> </beans>
<properties> <dubbo.version>2.7.0</dubbo.version> <spring-boot.version>2.0.6.RELEASE</spring-boot.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>${spring-boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.apache.dubbo</groupId> <artifactId>dubbo</artifactId> <version>${dubbo.version}</version> <exclusions> <exclusion> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> </exclusion> <exclusion> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-spring-boot-starter</artifactId> <version>${dubbo.version}</version> </dependency> <!-- Dubbo zookeeper registry dependency --> <dependency> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId> <version>3.4.9</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </exclusion> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </exclusion> <exclusion> <groupId>log4j</groupId> <artifactId>log4j</artifactId> </exclusion> <exclusion> <groupId>io.netty</groupId> <artifactId>netty</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-framework</artifactId> <version>2.12.0</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-recipes</artifactId> <version>2.12.0</version> </dependency> <dependency> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> <version>4.1.29.Final</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>21.0</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.5</version> </dependency> </dependencies> </dependencyManagement> <!-- dubbo --> <dependency> <groupId>org.apache.dubbo</groupId> <artifactId>dubbo</artifactId> </dependency> <dependency> <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-spring-boot-starter</artifactId> </dependency> <dependency> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> </dependency> <!-- zk registry dependency --> <dependency> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-framework</artifactId> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-recipes</artifactId> </dependency>
The text was updated successfully, but these errors were encountered:
API配置也会报错,貌似只能通过properties配置。今天刚学也踩到这个坑了。。。
@Configuration public class DubboConfiguration { @Bean public ApplicationConfig applicationConfig() { ApplicationConfig applicationConfig = new ApplicationConfig("provider"); return applicationConfig; } @Bean public RegistryConfig registryConfig() { RegistryConfig registryConfig = new RegistryConfig(); registryConfig.setAddress("zookeeper://127.0.0.1:2181"); registryConfig.setClient("curator"); return registryConfig; } @Bean public ProtocolConfig protocolConfig() { ProtocolConfig protocolConfig = new ProtocolConfig(); protocolConfig.setPort(20880); protocolConfig.setName("dubbo"); return protocolConfig; } }
application-dev.properties
# dubbo-provider.properties server.port=9090 #dubbo.application.default=false #dubbo.application.name=provider #dubbo.registry.address=zookeeper://127.0.0.1:2181 #dubbo.protocol.name=dubbo #dubbo.protocol.port=20880 #spring.main.allow-bean-definition-overriding=true
Sorry, something went wrong.
应该默认只读取 properties,同遇到这个问题
No branches or pull requests
环境
dubbo-2.7.0
dubbo-spring-boot-starter-2.7.0
同时使用xml作为
dubbo
的配置时,会出现以下异常:The text was updated successfully, but these errors were encountered: