소스 검색

热部署

xuqm 1 년 전
부모
커밋
9b051b3ae8
3개의 변경된 파일22개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 1
      pom.xml
  2. 16 0
      src/main/java/cn/org/bjca/trust/java/imserver/controller/HelloController.java
  3. 1 1
      src/main/resources/application.properties

+ 5 - 1
pom.xml

@@ -21,7 +21,11 @@
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-web</artifactId>
 		</dependency>
-
+		<!--引入热部署依赖-->
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-devtools</artifactId>
+		</dependency>
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-test</artifactId>

+ 16 - 0
src/main/java/cn/org/bjca/trust/java/imserver/controller/HelloController.java

@@ -0,0 +1,16 @@
+package cn.org.bjca.trust.java.imserver.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;
+
+@RestController
+@RequestMapping("hello")
+public class HelloController {
+    @GetMapping("/{id}")
+    public String getById(@PathVariable String id) throws Exception {
+        System.out.println("id ==> " + id);
+        return "{\n" + "    \"msg\": \"qdxorigin\",\n" + "    \"status\": \"201\",\n" + "    \"data\": \"Sbfuiaefhaikufhcsauik\"\n" + "}";
+    }
+}

+ 1 - 1
src/main/resources/application.properties

@@ -1 +1 @@
-
+server.port=4561