简单易懂的SpringBoot初级使用

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36481052/article/details/79055614

前两天在听同事说SpringBoot更好用,不需要配置文件,而且比ssm还简单你就说你还在等什么,赶紧来试试。

maven构建项目

1、访问http://start.spring.io/

2、选择构建工具Maven Project、Spring Boot版本1.4.7以及一些工程基本信息,点击“Switch to the full version.”java版本选择1.7,可参考下图所示:

3、点击Generate Project下载项目压缩包

4、解压后,使用IDEA,File->Open->选择解压后的文件夹-> OK !

导入成功后,会下载Jar包,你就选择允许导入(注意controller,service,dao,entity是我后来加进去的,压缩包是没有这几个文件的)

引入web模块

扫描二维码关注公众号,回复: 3037267 查看本文章

1、pom.xml中添加支持web的模块:

<dependency>  
        <groupId>org.springframework.boot</groupId>  
        <artifactId>spring-boot-starter-web</artifactId>  
 </dependency>  
pom.xml文件中默认有两个模块:

spring-boot-starter:核心模块,包括自动配置支持、日志和YAML;

spring-boot-starter-test:测试模块,包括JUnit、Hamcrest、Mockito。

猜你喜欢

转载自blog.csdn.net/qq_36481052/article/details/79055614