Update: T04/搭建service-producer模块

This commit is contained in:
2025-10-06 19:20:04 +08:00
parent 577e4d4462
commit 371e825200
6 changed files with 86 additions and 1 deletions
@@ -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);
}
}
@@ -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