diff --git a/Readme.md b/Readme.md
new file mode 100644
index 0000000..0c9b849
--- /dev/null
+++ b/Readme.md
@@ -0,0 +1,32 @@
+## Java Implementation
+
+#### 运行方式
+
+用./mvnw spring-boot:run运行
+h2 database在 localhost:8080/h2-console
+
+#### cURL测试
+
+用cURL测试/api/v1/product/create
+curl -X POST -H "Content-Type: application/json" --data '{"name":"product1","price":"1.0","stock":"5"}' http://localhost:8080/api/v1/product/create
+返回
+{"code":201,"name":"product1","message":"Product created"}
+
+再次用cURL测试/api/v1/product/create使用相同的name
+返回
+{"code":409,"message":"Product with the same name already exists"}
+
+用cURL测试/api/v1/product/{id}
+curl -X GET -H "Content-Type: application/json" http://localhost:8080/api/v1/product/product1
+返回
+{"product":{"price":1.0,"name":"product1","stock":5},"code":200,"message":"Product retrieved"}
+用cURL测试/api/v1/product/{id}使用不存在的name
+返回
+{"code":404,"message":"Product not found"}
+
+#### 代码结构
+- controller: 接受请求parameters然后调用service
+- service: 调用repository,处理业务逻辑。在必要时throw exception
+- repository: 继承JpaRepository,和database交互存储数据
+- product: Model class
+controller不直接调用repository,而是调用service负责业务逻辑。将来如要更改实现方式,只需更改service和repository,不用更改controller
diff --git a/pom.xml b/pom.xml
index b07ffb9..c590c1d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,11 +34,22 @@
org.springframework.boot
spring-boot-starter-data-jpa
+
+ com.h2database
+ h2
+ runtime
+
org.springframework.boot
spring-boot-starter-web
+
+ org.json
+ json
+ 20250517
+
+
org.springframework.boot
spring-boot-starter-test
diff --git a/src/main/java/com/ljc42/demo/Controller/HelloController.java b/src/main/java/com/ljc42/demo/Controller/HelloController.java
deleted file mode 100644
index 41714ec..0000000
--- a/src/main/java/com/ljc42/demo/Controller/HelloController.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.ljc42.demo;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-
-@Controller
-public class HelloController {
-
- @GetMapping("/")
- public String hello() {
- return "hello.json";
- }
-}
diff --git a/src/main/java/com/ljc42/product/Controller/ProductController.java b/src/main/java/com/ljc42/product/Controller/ProductController.java
new file mode 100644
index 0000000..6aef2c6
--- /dev/null
+++ b/src/main/java/com/ljc42/product/Controller/ProductController.java
@@ -0,0 +1,61 @@
+package com.ljc42.product.Controller;
+
+import com.ljc42.product.Exceptions.ProductExitsException;
+import com.ljc42.product.Exceptions.ProductNotFoundException;
+import com.ljc42.product.Model.Product;
+import com.ljc42.product.Service.ProductService;
+import org.json.JSONObject;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+import java.util.Objects;
+
+@RestController
+public class ProductController {
+
+ private final ProductService productService;
+
+ public ProductController(ProductService productService) {
+ this.productService = productService;
+ }
+
+ @GetMapping("/api/v1/product/{name}")
+ public ResponseEntity