解决消费者子模块的yml必须要写dataSourceorg.springframework.boot spring-boot-starter-web2.6.2 org.springframework.boot spring-boot-test2.6.2 com.alibaba.boot dubbo-spring-boot-starter0.2.0 com.baomidou mybatis-plus-boot-starter3.4.3.4 mysql mysql-connector-java8.0.27 org.projectlombok lombok1.18.22 com.mchange c3p00.9.5.2 com.google.code.gson gson2.8.5
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})项目结构 消费者的启动类
@EnableDubbo @SpringBootApplication @MapperScan(basePackages = "com.guigu.www.mapper") public class DubboProviderApplication { public static void main(String[] args) { SpringApplication.run(DubboProviderApplication.class,args); } }消费者的yml配置
server: port: 8200 spring: application: name: boot-zookeeper-dubbo-consumer dubbo: application: name: boot-zookeeper-dubbo-consumer protocol: name: dubbo port: 20882 registry: address: zookeeper://192.168.43.17:2181
@EnableDubbo @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) public class DubboConsumerApplication { public static void main(String[] args) { SpringApplication.run(DubboConsumerApplication.class,args); } }提供者yml配置
server: port: 8100 dubbo: application: name: boot-zookeeper-dubbo-proivder protocol: name: dubbo port: 20880 registry: address: zookeeper://192.168.43.17:2181 spring: application: name: boot-zookeeper-dubbo-proivder datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql:///test username: root password: 123456
注意以上yml的dubbo端口不能重复。
参考项目:点击获取springboot+zookeeper+dubbo
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)