1.需求分析
2.工程搭建
使用idea创建spring boot工程(工程创建方式可以通过https://start.spring.io创建或者使用idea工具创建) ,pom.xml内容如下
1 <?xml version="1.0" encoding="UTF-8"?> 2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4 <modelVersion>4.0.0</modelVersion> 5 <parent> 6 <groupId>org.springframework.boot</groupId> 7 <artifactId>spring-boot-starter-parent</artifactId> 8 <version>2.2.2.RELEASE</version> 9 <relativePath/> <!-- lookup parent from repository --> 10 </parent> 11 <groupId>com.zcq</groupId> 12 <artifactId>seckill1</artifactId> 13 <version>0.0.1-SNAPSHOT</version> 14 <name>seckill1</name> 15 <description>Demo project for Spring Boot</description> 16 17 <properties> 18 <java.version>1.8</java.version> 19 </properties> 20 21 <dependencies> 22 <!--运维监控接口,监控项目健康情况--> 23 <dependency> 24 <groupId>org.springframework.boot</groupId> 25 <artifactId>spring-boot-starter-actuator</artifactId> 26 </dependency> 27 <!--springboot-jpa--> 28 <!--<dependency> 29 <groupId>org.springframework.boot</groupId> 30 <artifactId>spring-boot-starter-data-jpa</artifactId> 31 </dependency>--> 32 <!--redis--> 33 <dependency> 34 <groupId>org.springframework.boot</groupId> 35 <artifactId>spring-boot-starter-data-redis</artifactId> 36 </dependency> 37 <!--模板引擎--> 38 <dependency> 39 <groupId>org.springframework.boot</groupId> 40 <artifactId>spring-boot-starter-thymeleaf</artifactId> 41 </dependency> 42 <dependency> 43 <groupId>org.springframework.boot</groupId> 44 <artifactId>spring-boot-starter-web</artifactId> 45 </dependency> 46 <!--热部署--> 47 <dependency> 48 <groupId>org.springframework.boot</groupId> 49 <artifactId>spring-boot-devtools</artifactId> 50 <scope>runtime</scope> 51 <optional>true</optional> 52 </dependency> 53 <!--mysql--> 54 <dependency> 55 <groupId>mysql</groupId> 56 <artifactId>mysql-connector-java</artifactId> 57 <scope>runtime</scope> 58 </dependency> 59 60 <!--JSR-303参数验证(比如业务层 ,接口层..参数校验)--> 61 <dependency> 62 <groupId>org.springframework.boot</groupId> 63 <artifactId>spring-boot-starter-validation</artifactId> 64 </dependency> 65 66 <!-- 添加 jetty 服务启动,可以代替tomcat --> 67 <dependency> 68 <groupId>org.springframework.boot</groupId> 69 <artifactId>spring-boot-starter-jetty</artifactId> 70 </dependency> 71 <!--消息机制--> 72 <dependency> 73 <groupId>org.springframework.kafka</groupId> 74 <artifactId>spring-kafka</artifactId> 75 </dependency> 76 <!--springboot测试--> 77 <dependency> 78 <groupId>org.springframework.boot</groupId> 79 <artifactId>spring-boot-starter-test</artifactId> 80 <scope>test</scope> 81 <exclusions> 82 <exclusion> 83 <groupId>org.junit.vintage</groupId> 84 <artifactId>junit-vintage-engine</artifactId> 85 </exclusion> 86 </exclusions> 87 </dependency> 88 </dependencies> 89 90 <!--springboot-maven插件--> 91 <build> 92 <plugins> 93 <plugin> 94 <groupId>org.springframework.boot</groupId> 95 <artifactId>spring-boot-maven-plugin</artifactId> 96 </plugin> 97 </plugins> 98 </build> 99 100 </project>
3.测试环境
springboot微服务项目系统秒杀模块——01环境搭建和测试
原文:https://www.cnblogs.com/android-zcq/p/12186009.html