commit
48c20ea6c1
4 changed files with 74 additions and 0 deletions
@ -0,0 +1,39 @@ |
|||||
|
<?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>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-parent</artifactId> |
||||
|
<version>2.3.2.RELEASE</version> |
||||
|
</parent> |
||||
|
|
||||
|
<groupId>cn.wolfcode</groupId> |
||||
|
<artifactId>springboot-docker-demo</artifactId> |
||||
|
<version>1.0-SNAPSHOT</version> |
||||
|
|
||||
|
<properties> |
||||
|
<maven.compiler.source>8</maven.compiler.source> |
||||
|
<maven.compiler.target>8</maven.compiler.target> |
||||
|
</properties> |
||||
|
|
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
<build> |
||||
|
<plugins> |
||||
|
<plugin> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
</build> |
||||
|
</project> |
@ -0,0 +1,12 @@ |
|||||
|
package cn.wolfcode; |
||||
|
|
||||
|
import org.springframework.boot.SpringApplication; |
||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
|
||||
|
@SpringBootApplication |
||||
|
public class SpringBootDockerServer { |
||||
|
|
||||
|
public static void main(String[] args) { |
||||
|
SpringApplication.run(SpringBootDockerServer.class, args); |
||||
|
} |
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
package cn.wolfcode.controller; |
||||
|
|
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/users") |
||||
|
public class UserController { |
||||
|
|
||||
|
@GetMapping("/{name}") |
||||
|
public HashMap<Object, Object> index(@PathVariable String name) { |
||||
|
HashMap<Object, Object> map = new HashMap<>(); |
||||
|
map.put("id", Math.random() + 1); |
||||
|
map.put("name", name); |
||||
|
return map; |
||||
|
} |
||||
|
} |
@ -0,0 +1,2 @@ |
|||||
|
server: |
||||
|
port: 9080 |
Loading…
Reference in new issue