Update: T04/搭建service-producer模块
This commit is contained in:
@@ -7,7 +7,7 @@ spring:
|
|||||||
config:
|
config:
|
||||||
server:
|
server:
|
||||||
git:
|
git:
|
||||||
uri: xxxxx
|
uri: http://47.121.181.112:3000/wonder/spring-cloud-config
|
||||||
search-paths: config-files
|
search-paths: config-files
|
||||||
|
|
||||||
eureka:
|
eureka:
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
<modules>
|
<modules>
|
||||||
<module>eureka-server</module>
|
<module>eureka-server</module>
|
||||||
<module>config-server</module>
|
<module>config-server</module>
|
||||||
|
<module>service-producer</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?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>cn.hezhaohui</groupId>
|
||||||
|
<artifactId>spring-cloud-template</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>service-producer</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>21</maven.compiler.source>
|
||||||
|
<maven.compiler.target>21</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-netflix-eureka-client</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
package cn.hezhaohui.serviceproducer;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
|
||||||
|
public class ServiceProducerApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(ServiceProducerApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package cn.hezhaohui.serviceproducer.controller;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api")
|
||||||
|
public class HealthController {
|
||||||
|
|
||||||
|
@Value("${test.message}")
|
||||||
|
private String testMessage;
|
||||||
|
|
||||||
|
@GetMapping("/health")
|
||||||
|
public String health() {
|
||||||
|
return "Wow, nice to meet you!" + "\n" + testMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: service-producer
|
||||||
|
cloud:
|
||||||
|
config:
|
||||||
|
uri: http://localhost:8888
|
||||||
|
fail-fast: true
|
||||||
|
eureka:
|
||||||
|
client:
|
||||||
|
service-url:
|
||||||
|
defaultZone: http://localhost:8761/eureka
|
||||||
Reference in New Issue
Block a user