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