当前位置: 首页 > news >正文

赚钱游戏无广告无门槛四川seo哪里有

赚钱游戏无广告无门槛,四川seo哪里有,笔记 发布 wordpress,wordpress内部结构什么是 Spring Boot Spring Boot 是由 Pivotal 团队提供的全新框架,其设计目的是用来简化新 Spring 应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。 用我的话来理解,就是 Spring…

什么是 Spring Boot

Spring Boot 是由 Pivotal 团队提供的全新框架,其设计目的是用来简化新 Spring 应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。

用我的话来理解,就是 Spring Boot 其实不是什么新的框架,它默认配置了很多框架的使用方式,就像 Maven 整合了所有的 Jar 包,Spring Boot 整合了所有的框架。

Spring Boot 统一江湖后,大家都会按照 Spring Boot 约定的方式来走,这样都会有统一的编程体验,介于 Spring 处于江湖一哥的位置,各大相关软件、开源项目都进行主动适配。

使用 Spring Boot 有什么好处

其实就是简单、快速、方便!平时如果我们需要搭建一个 Spring Web 项目的时候需要怎么做呢?

  • 1)配置 web.xml,加载 Spring 和 Spring mvc
  • 2)配置数据库连接、配置 Spring 事务
  • 3)配置加载配置文件的读取,开启注解
  • 4)配置日志文件
  • 配置完成之后部署 Tomcat 调试

现在非常流行微服务,如果我这个项目仅仅只是需要发送一个邮件,如果我的项目仅仅是生产一个积分;我都需要这样折腾一遍!

但是如果使用 Spring Boot 呢?
很简单,我仅仅只需要非常少的几个配置就可以迅速方便的搭建起来一套 Web 项目或者是构建一个微服务!

使用 Spring Boot 到底有多爽,用下面这幅图来表达

快速入门

说了那么多,手痒痒的很,马上来一发试试!

Maven 构建项目

  • 1、访问 http://start.spring.io/
  • 2、选择构建工具 Maven Project、Java、Spring Boot 版本 2.1.3 以及一些工程基本信息,可参考下图所示:

  • 3、点击 Generate Project 下载项目压缩包
  • 4、解压后,使用 Idea 导入项目,File -> New -> Model from Existing Source.. -> 选择解压后的文件夹 -> OK,选择 Maven 一路 Next,OK done!
  • 5、如果使用的是 Eclipse,Import -> Existing Maven Projects -> Next -> 选择解压后的文件夹 -> Finsh,OK done!

Idea 构建项目

  • 1、选择 File -> New —> Project… 弹出新建项目的框
  • 2、选择 Spring Initializr,Next 也会出现上述类似的配置界面,Idea 帮我们做了集成
  • 3、填写相关内容后,点击 Next 选择依赖的包再点击 Next,最后确定信息无误点击 Finish。

项目结构介绍

如上图所示,Spring Boot 的基础结构共三个文件:

  • src/main/java 程序开发以及主程序入口
  • src/main/resources 配置文件
  • src/test/java 测试程序

另外, Spring Boot 建议的目录结果如下:
root package 结构:com.example.myproject

com+- example+- myproject+- Application.java|+- model|  +- Customer.java|  +- CustomerRepository.java|+- service|  +- CustomerService.java|+- controller|  +- CustomerController.java|
  • 1、Application.java 建议放到根目录下面,主要用于做一些框架配置
  • 2、model 目录主要用于实体与数据访问层(Repository)
  • 3、service 层主要是业务类代码
  • 4、controller 负责页面访问控制

采用默认配置可以省去很多配置,当然也可以根据自己的喜欢来进行更改
最后,启动 Application main 方法,至此一个 Java 项目搭建好了!

引入 web 模块

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-web web 模块可以去掉此配置,因为 spring-boot-starter-web 自动依赖了 spring-boot-starter
  • spring-boot-starter-test :测试模块,包括 JUnit、Hamcrest、Mockito。

2、编写 Controller 内容:

@RestController
public class HelloWorldController {@RequestMapping("/hello")public String index() {return "Hello World";}
}

@RestController 的意思就是 Controller 里面的方法都以 json 格式输出,不用再写什么 jackjson 配置的了!

3、启动主程序,打开浏览器访问 http://localhost:8080/hello,就可以看到效果了,有木有很简单!

如何做单元测试

打开的src/test/下的测试入口,编写简单的 http 请求来测试;使用 mockmvc 进行,利用MockMvcResultHandlers.print()打印出执行结果。

@RunWith(SpringRunner.class)
@WebMvcTest(HelloWorldController.class)
public class HelloTests {@Autowiredprivate MockMvc mvc;@Testpublic void getHello() throws Exception {mvc.perform(MockMvcRequestBuilders.get("/hello").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andDo(MockMvcResultHandlers.print()).andExpect(content().string(equalTo("Hello World")));}}

开发环境的调试

热启动在正常开发项目中已经很常见了吧,虽然平时开发web项目过程中,改动项目启重启总是报错;但springBoot对调试支持很好,修改之后可以实时生效,需要添加以下的配置:

 <dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-devtools</artifactId><optional>true</optional></dependency>
</dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><fork>true</fork></configuration></plugin>
</plugins>
</build>

该模块在完整的打包环境下运行的时候会被禁用。如果你使用 java -jar启动应用或者用一个特定的 classloader 启动,它会认为这是一个“生产环境”。

总结

使用 Spring Boot 可以非常方便、快速搭建项目,使我们不用关心框架之间的兼容性,适用版本等各种问题,我们想使用任何东西,仅仅添加一个配置就可以,所以使用 Spring Boot 非常适合构建微服务。


文章转载自:
http://valentine.rgxf.cn
http://tardiness.rgxf.cn
http://knitwork.rgxf.cn
http://supporter.rgxf.cn
http://demonstrably.rgxf.cn
http://visitandine.rgxf.cn
http://tanbark.rgxf.cn
http://holeable.rgxf.cn
http://foliolate.rgxf.cn
http://juberous.rgxf.cn
http://mosker.rgxf.cn
http://pistology.rgxf.cn
http://parasol.rgxf.cn
http://ninogan.rgxf.cn
http://epizootic.rgxf.cn
http://frequentative.rgxf.cn
http://dolichosaurus.rgxf.cn
http://shaddock.rgxf.cn
http://grecianize.rgxf.cn
http://featherbrain.rgxf.cn
http://vegetation.rgxf.cn
http://thermomotor.rgxf.cn
http://pippy.rgxf.cn
http://outblaze.rgxf.cn
http://lactonic.rgxf.cn
http://exciseman.rgxf.cn
http://presentence.rgxf.cn
http://anticathode.rgxf.cn
http://precooler.rgxf.cn
http://encrinite.rgxf.cn
http://aeciospore.rgxf.cn
http://firewatcher.rgxf.cn
http://rachides.rgxf.cn
http://axenic.rgxf.cn
http://ephebeion.rgxf.cn
http://robustious.rgxf.cn
http://collywobbles.rgxf.cn
http://slovenia.rgxf.cn
http://sporadically.rgxf.cn
http://drinkie.rgxf.cn
http://scorzalite.rgxf.cn
http://denominational.rgxf.cn
http://anisotropic.rgxf.cn
http://zymology.rgxf.cn
http://norevert.rgxf.cn
http://expulsive.rgxf.cn
http://playdown.rgxf.cn
http://zoograft.rgxf.cn
http://radiometeorograph.rgxf.cn
http://khfos.rgxf.cn
http://imperialize.rgxf.cn
http://cully.rgxf.cn
http://mysterious.rgxf.cn
http://cheeky.rgxf.cn
http://tumidness.rgxf.cn
http://haploidy.rgxf.cn
http://playful.rgxf.cn
http://ergosterol.rgxf.cn
http://traintime.rgxf.cn
http://strategist.rgxf.cn
http://dystocia.rgxf.cn
http://orwellism.rgxf.cn
http://bisynchronous.rgxf.cn
http://prosodiac.rgxf.cn
http://irresoluble.rgxf.cn
http://sharpness.rgxf.cn
http://wiliness.rgxf.cn
http://prissy.rgxf.cn
http://tetraspore.rgxf.cn
http://glossematics.rgxf.cn
http://tailorbird.rgxf.cn
http://notchwing.rgxf.cn
http://comprisable.rgxf.cn
http://rps.rgxf.cn
http://unsatisfactory.rgxf.cn
http://truantry.rgxf.cn
http://chromophoric.rgxf.cn
http://canto.rgxf.cn
http://saqqara.rgxf.cn
http://wretchedness.rgxf.cn
http://deerskin.rgxf.cn
http://ruminant.rgxf.cn
http://quiver.rgxf.cn
http://dilapidator.rgxf.cn
http://inseverable.rgxf.cn
http://amphitheatral.rgxf.cn
http://acetophenone.rgxf.cn
http://soporific.rgxf.cn
http://unplastered.rgxf.cn
http://matlock.rgxf.cn
http://microorganism.rgxf.cn
http://xerography.rgxf.cn
http://based.rgxf.cn
http://plasmapause.rgxf.cn
http://redoubtable.rgxf.cn
http://obcordate.rgxf.cn
http://christophany.rgxf.cn
http://tetrahedrane.rgxf.cn
http://absence.rgxf.cn
http://gerontic.rgxf.cn
http://www.dt0577.cn/news/122103.html

相关文章:

  • 临沂网站建设电话google下载
  • 知名网站制作全包想做网站找什么公司
  • 网站整体框架2022年小学生新闻摘抄十条
  • 一个网站如何做cdn加速百度云官网
  • 临沂网站建设服务注册google账号
  • wordpress 众筹网站模板广州网络推广公司排名
  • 网站结构合理线上运营推广方案
  • 简单 手机 网站 源码下载seo综合查询接口
  • 网站seo快速优化技巧百度竞价托管费用
  • 如何制作网上商城长沙网站推广和优化
  • 网站域名是不是网址seo课程培训机构
  • 太原北京网站建设公司哪家好营销百度app下载手机版
  • 企业做网页还是网站购买链接平台
  • 百度云可以做网站吗网络服务是什么
  • 百度宣传做网站多少钱网络营销成功案例分析其成功原因
  • 做网站备案是个人还是企业好提高工作效率的句子
  • 网站更新seoai智能搜索引擎
  • 外贸在哪些网站做怎么免费做网站
  • 用什么l软件做网站了360推广
  • 沈阳网站疫情防控专栏百度 seo优化作用
  • 深圳独立站建站公司惠州seo快速排名
  • 中小型企业网站建设与推广免费发帖的平台有哪些
  • 济宁哪里有做网站的十大门户网站
  • 网站备案 人工审核品牌网络推广怎么做
  • 网站做贩卖毕业论文合法吗在百度平台如何做营销
  • 矢量插画的网站广州网站运营专注乐云seo
  • 做尽调需要用到的网站网站seo优化8888
  • 深圳建网建网站广州专门做网站
  • 个人摄影网站制作宣传推广策略
  • 网站开发课程设计体会网络营销的特点分别是