4.0.0org.springframework.bootspring-boot-starter-parent2.7.5com.exampleprovider0.0.1providerDemo project for Spring Boot1.8org.springframework.bootspring-boot-starter-weborg.springframework.bootspring-boot-starter-testtestorg.projectlomboklombok1.18.22test-releasehttp://192.168.88.100:8081/repository/test-release/test-snapshothttp://192.168.88.100:8081/repository/test-snapshot/org.apache.maven.pluginsmaven-compiler-plugin3.8.11.81.8UTF-8
package com.example.provider.entry;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author qeq
* @date 2022-10-21 14:29
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Test implements Serializable {
private Long id;
private String name;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
配置文件设置端口:application.properties
server.port=8085
1
测试运行: 127.0.0.1:8086/testController/test
新建 项目:consumer:
4.0.0org.springframework.bootspring-boot-starter-parent2.7.5com.exampleconsumer0.0.1-SNAPSHOTconsumerDemo project for Spring Boot1.8org.springframework.bootspring-boot-starter-weborg.springframework.bootspring-boot-starter-testtestorg.projectlomboklombok1.18.22com.exampleprovider0.0.1org.springframework.bootspring-boot-maven-plugin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
server.port=8086
1
package com.example.consumer.controller;
import com.example.provider.entry.Test;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author qeq
* @date 2022-10-21 14:21
*/
@RestController
@RequestMapping("/testController")
public class TestController {
/**
* 127.0.0.1:8086/testController/test
* @author qeq
* @date 2022/10/21 14:22
* @return String
**/
@RequestMapping("test")
public String test(){
String str = "success-consumer";
System.out.println(str);
Test test = new Test();
test.setName("测试nexus私服的 deploy和依赖引入");
System.out.println(test.toString());
return str;
}
}