3.1-2 在linux上部署spring cloud配置服务的步骤

1、构建jar:在idea中导入工程后,使用maven的package命令打包为jar:configurationserver-0.0.1-SNAPSHOT.jar。
2、修改配置文件application.yml为如下内容:
server:
    port: 8888
spring:
   profiles:
     active: native
   cloud:
      config:
        server:
            native:
###               searchLocations: classpath:config/,classpath:config/licensingservice
3、将该配置文件更新到configurationserver-0.0.1-SNAPSHOT.jar中的\BOOT-INF\classes\目录下:
4、在centos7上创建部署目录如下,并将应用程序配置文件放到相应的目录里:
[root@localhost confsvr]# pwd
/home/work/microservice/spmia-chapter3-master/confsvr
[root@localhost confsvr]# tree
.
├── config
│   ├── licensingservice
│   │   ├── licensingservice-dev.yml
│   │   ├── licensingservice-prod.yml
│   │   └── licensingservice.yml
│   └── organizationservice
│       └── organizationservice.yml
└── configurationserver-0.0.1-SNAPSHOT.jar
 
3 directories, 5 files
[root@localhost confsvr]#
5、访问配置信息:
 
posted @ 2019-12-02 20:48  mongotea  阅读(609)  评论(0编辑  收藏  举报