zoukankan      html  css  js  c++  java
  • 阿里微服务解决方案-Alibaba Cloud之服务提供方搭建(二)

    一、新建服务提供方模块

    1.1 右键父工程 New—> Module

    1.2 选择 Maven项目,然后 Next

    1.3 指定父工程,并且子模块以端口号结尾,方便调试 

     

    1.4 因为父工程已经添加了公共依赖,所以子模块只需要添加需要的依赖即可,这里暂时不添加其他依赖

     

    1.5 创建启动类

    @SpringBootApplication
    public class ProviderApplication8000 {
    
        public static void main(String[] args) {
            SpringApplication.run(ProviderApplication8000.class,args);
        }
    }

    1.6 创建Controller用于调试

    @RestController
    @RequestMapping("/provider-8000")
    public class IndexController {
    
        @GetMapping("/index")
        public String index(){
            return "/provider-8000/index";
        }
    }

    1.7 创建配置文件并进行配置

    server:
      port: 8000

    至此,服务提供方也准备完毕,多个服务提供也通过以上步骤进行创建,修改端口号即可

    当前的目录结构如下

  • 相关阅读:
    SQLServer XML
    批量数据入库
    iBatis --> MyBatis
    一句话,一段文
    一首诗,一阕词
    Web Service
    一天一首现代诗
    一天一首歌
    DB2
    Kafka
  • 原文地址:https://www.cnblogs.com/damaoa/p/12941494.html
Copyright © 2011-2022 走看看