91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Idea下SpringCloud2實驗(二、Eureka-服務提供者)

發布時間:2020-06-19 09:16:44 來源:網絡 閱讀:792 作者:shayang88 欄目:編程語言

一、創建SpringBoot項目springcloud-eureka-client-order,過程如上一篇,有一點需要注意,選擇Eureka客戶端依賴
Idea下SpringCloud2實驗(二、Eureka-服務提供者)

二、配置文件
1、pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.jane</groupId>
    <artifactId>springcloud-eureka-client-order</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>springcloud-eureka-client-order</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>Greenwich.SR1</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <!--open feign-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
            <version>2.0.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-openfeign-core</artifactId>
            <version>2.0.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>io.github.openfeign.form</groupId>
            <artifactId>feign-form-spring</artifactId>
            <version>3.2.2</version>
        </dependency>
        <!--feign-->
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

2、啟動文件

package com.jane.springcloudeurekaclientorder;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.ComponentScan;

@EnableDiscoveryClient
@SpringBootApplication
@ComponentScan("com.jane")
@EnableFeignClients
public class SpringcloudEurekaClientOrderApplication {

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

}

3、application.properties

server.port=6010
spring.application.name=springcloud-eureka-client-order
eureka.client.serviceUrl.defaultZone=http://127.0.0.1:6001/eureka/

4、服務提供API,TestController

package com.jane.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @Value("${server.port}")
    String port;

    @RequestMapping(value = "/test", method = RequestMethod.GET)
    public String test(){
        return "hello,this is client-order:" + port;
    }

}

三、啟動服務
1、服務正常
Idea下SpringCloud2實驗(二、Eureka-服務提供者)
2、查看注冊中心
Idea下SpringCloud2實驗(二、Eureka-服務提供者)

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

察隅县| 南乐县| 博爱县| 神池县| 仁化县| 阳朔县| 双鸭山市| 隆化县| 永胜县| 贵阳市| 新建县| 贵港市| 二连浩特市| 新津县| 从化市| 军事| 淮北市| 都江堰市| 安泽县| 清新县| 乌苏市| 茌平县| 通城县| 宁远县| 陆良县| 曲周县| 望都县| 卢龙县| 贵德县| 黔江区| 如皋市| 浮山县| 德钦县| 汉中市| 英德市| 南靖县| 普洱| 西昌市| 松溪县| 大安市| 建宁县|