1.创建maven工程:
2. 创建工程名称:
3.删除父工程下的src文件夹,指定打包方式为pom,添加maven依赖:
4.右键项目添加子工程:
5.添加子工程名称:
6.子工程创建成功:
7.依次类推创建多个子工程:
8.在student-server搭建springboot工程:
添加pom.xml文件
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<build.jdk.version>1.8</build.jdk.version>
<spring.boot.version>1.5.9.RELEASE</spring.boot.version>
<slf4j.version>1.7.25</slf4j.version>
</properties>
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>${spring.boot.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <version>${spring.boot.version}</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.47</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>${slf4j.version}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>${build.jdk.version}</source> <target>${build.jdk.version}</target> </configuration> </plugin> </plugins> </build>
9.创建启动类Application和测试Testcontroller:
Application:
@SpringBootApplication public class Application { private static final Logger LOG = LoggerFactory.getLogger(Application.class); public static void main(String[] args) { SpringApplication app = new SpringApplication(Application.class); app.setBannerMode(Banner.Mode.OFF); app.setWebEnvironment(true); app.run(args); LOG.info("**************** Startup Success ****************"); } }
TestController:
@Controller public class TestController { @RequestMapping("/test") @ResponseBody public String test(String str) { System.out.println("*********" + str + "*******"); return str; } }
10.运行Application类main方法启动springboot:
成功