重慶分公司,新征程啟航
為企業提供網站建設、域名注冊、服務器等服務
為企業提供網站建設、域名注冊、服務器等服務
一、創建SpringBoot項目springcloud-eureka-client-order,過程如上一篇,有一點需要注意,選擇Eureka客戶端依賴
發展壯大離不開廣大客戶長期以來的信賴與支持,我們將始終秉承“誠信為本、服務至上”的服務理念,堅持“二合一”的優良服務模式,真誠服務每家企業,認真做好每個細節,不斷完善自我,成就企業,實現共贏。行業涉及水電改造等,在網站建設公司、全網營銷推廣、WAP手機網站、VI設計、軟件開發等項目上具有豐富的設計經驗。
二、配置文件
1、pom.xml
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.1.4.RELEASE
com.jane
springcloud-eureka-client-order
0.0.1-SNAPSHOT
springcloud-eureka-client-order
Demo project for Spring Boot
1.8
Greenwich.SR1
org.springframework.cloud
spring-cloud-starter-netflix-eureka-client
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-starter-web
org.springframework.cloud
spring-cloud-starter-openfeign
2.0.2.RELEASE
org.springframework.cloud
spring-cloud-openfeign-core
2.0.2.RELEASE
io.github.openfeign.form
feign-form-spring
3.2.2
org.springframework.cloud
spring-cloud-dependencies
${spring-cloud.version}
pom
import
org.springframework.boot
spring-boot-maven-plugin
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、服務正常
2、查看注冊中心