Springboot入门级文档一.开发环境1.MyEclipseEnterpriseWorkbench(Version:2015CI)2.JDK1.73.apache-tomcat-8.0.32二.Maven项目创建1.创建一个Maven项目下一步:下一步:下一步:下一步:工程创建完成:2.配置pom.xml文件3.编写测试代码1.Bean类(Person.java)1.packageopensoruce.com.test.spring.boot;2.importjava.io.Serializable;3.importcom.fasterxml.jackson.databind.annotation.JsonSerialize;4.5.@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)6.publicclassPerson7.{8.privateStringname;9.privateintold;10.11.publicPerson()12.{13.}14.15.publicPerson(Stringname,intold)16.{17.this.name=name;18.this.old=old;19.}20.21.publicvoidsetName(Stringname)22.{23.this.name=name;24.}25.publicvoidsetOld(intold)26.{27.this.old=old;28.}29.publicStringgetName()30.{31.returnthis.name;32.}33.publicintgetOld()34.{35.returnthis.old;36.}37.38.}2.控制类(PerController.java)packageopensoruce.com.test.spring.boot;importjava.io.UnsupportedEncodingException;importorg.springframework.boot.SpringApplication;importorg.springframework.boot.autoconfigure.EnableAutoConfiguration;importorg.springframework.web.bind.annotation.PathVariable;importorg.springframework.web.bind.annotation.RequestMapping;importorg.springframework.web.bind.annotation.ResponseBody;importorg.springframework.web.bind.annotation.RestController;@RestController@RequestMapping(/person)publicclassPerController{@RequestMapping(/{old}/{name})publicPersonview(@PathVariable(old)intold,@PathVariable(name)Stringname){name=changeChinseToChar(name);//解决参数值为中文的时候,乱码问题Personperson=newPerson();person.setName(name);person.setOld(old);returnperson;}privateStringchangeChinseToChar(Stringvalue){Stringtemp=;bytebb[];try{bb=value.getBytes(ISO-8859-1);temp=newString(bb,UTF-8);}catch(UnsupportedEncodingExceptione){e.printStackTrace();}returntemp;}}3.注册(App.java)packageopensoruce.com.test.spring.boot;importorg.springframework.boot.SpringApplication;importorg.springframework.boot.autoconfigure.EnableAutoConfiguration;importorg.springframework.context.annotation.ComponentScan;importorg.springframework.web.bind.annotation.RestController;@RestController@ComponentScan@EnableAutoConfigurationpublicclassApp{publicstaticvoidmain(String[]args){SpringApplication.run(App.class,args);}}4.更新项目5.编译及打包:选中项目,右键,如图所示三.测试结果1.运行程序,选中app.java,如下图所示:2.服务启动,如下图所示:3.打开浏览器,输入如下图所示的地址,得到结果。