提供用于 APIXSIX 负载均衡的项目

This commit is contained in:
YunaiV
2020-05-02 00:01:25 +08:00
parent b53f0a76af
commit c1c6b86316
6 changed files with 91 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
<?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">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>lab-56-demo01</artifactId>
<dependencies>
<!-- 实现对 Spring MVC 的自动化配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,14 @@
package cn.iocoder.springboot.lab56;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Demo01Application {
public static void main(String[] args) {
System.setProperty("server.port", "18080"); // 端口 18080
SpringApplication.run(Demo01Application.class, args);
}
}

View File

@@ -0,0 +1,14 @@
package cn.iocoder.springboot.lab56;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Demo02Application {
public static void main(String[] args) {
System.setProperty("server.port", "28080"); // 端口 28080
SpringApplication.run(Demo02Application.class, args);
}
}

View File

@@ -0,0 +1,20 @@
package cn.iocoder.springboot.lab56.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("/demo")
public class DemoController {
@Value("${server.port}")
private Integer serverPort;
@GetMapping("/echo")
public String echo() {
return "echo:" + serverPort;
}
}

19
lab-56/pom.xml Normal file
View File

@@ -0,0 +1,19 @@
<?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">
<parent>
<artifactId>labs-parent</artifactId>
<groupId>cn.iocoder.springboot.labs</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>lab-56</artifactId>
<packaging>pom</packaging>
<modules>
<module>lab-56-demo01</module>
</modules>
</project>

View File

@@ -88,6 +88,7 @@
<module>labx-19</module>
<module>labx-20</module>
<module>lab-55</module>
<module>lab-56</module>
</modules>