
1.创建项目1.首先确保计算机上安装了JDK、IDEA、MySQL数据库等开发需要使用的软件并在IDEA中配置了Maven 3.6.3项目管理工具。2.在IDEA欢迎界面点击【New Project】按钮创建项目左侧选择【Spring Initializr】选项进行Spring Boot项目快速构建。3.设置为GroupArtifact其余选项使用默认值。单击【Next】进入Spring Boot场景依赖选择界面。4.给项目添加Spring Web、MyBatis Framework、MySQL Driver的依赖。点击【Next】按钮完成项目创建。5.首次创建完Spring Initializr项目时解析项目依赖需消耗一定时间Resolving dependencies of store…。2.运行项目1.找到项目的入口类被SpringBootApplication注解修饰然后运行启动类启动过程如果控制台输出Spring图形则表示启动成功。3.项目配置1.如果启动项目时提示Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.2.解决以上操作提示的方法在resources文件夹下的application.properties文件中添加数据源的配置。spring.datasource.urljdbc:mysql://localhost:3306/storeuseUnicodetruecharacterEncodingutf-8serverTimezoneAsia/Shanghaispring.datasource.usernamerootspring.datasource.password1234563.为了便于查询JSON数据隐藏没有值的属性减少流量的消耗服务器不应该向客户端响应为NULL的属性。可以在属性或类之前添加JsonInclude(valueInclude.NON_NULL)也可以在application.properties中添加全局的配置。spring.jackson.default-property-inclusionNON_NULL完成以上操作即可开些编写代码。