ECOM應用程序 - 春季啟動
使用Spring Boot進行ECOM應用程序REST API
春季啟動器依賴性
- org.springframework.boot:Spring-boot-starter-web-用於構建Web的起動器,包括使用Spring的RESTFEL,應用程序。
https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web - org.springframework.boot:spring-boot-starter-data-jpa-使用彈簧數據JPA與Hibernate一起使用
https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-boot-starter-data-jpa - org.springframework.boot:spring-boot-starter-validation-使用Hibernate驗證器使用Java Bean驗證的起動器
https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-validation - org.springframework.boot:Spring-boot-Starter測試 - 用於測試彈簧啟動應用程序的啟動器,包括Junit Jupiter,Hamcrest和Mockito
https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test
其他依賴性
- mysql:mysql-connector-java-MySQL的JDBC驅動程序
https://mvnrepository.com/artifact/mysql/mysql-connector-java - org.projectlombok:Lombok-自動資源管理,自動生成Getters,Setter,Equals,Hashcode和Tostring等等
https://mvnrepository.com/artifact/org.projectlombok/lombok - org.mapsstruct:映射用於生成類型 - 安全bean mappers的註釋處理器
- io.springfox:Springfox-swagger2-JSON API文檔用於彈簧應用程序https://mvnrepository.com/artifact/io.springfox/springfox/springfox-swagger2
- io.springfox:Springfox-swagger-UI-JSON API文檔https://mvnrepository.com/artifact/io.springfox/springfox/springfox-springfox-swagger-swagger-swagger-ui
配置Swagger
- 添加春季狐狸Swagger2和Swagger UI Depeenty
- 使用 @EnablesWagger2註釋啟用代碼中的Swagger
- 通過創建案例班來配置Swagger