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

北京平台网站建设多少钱新媒体运营

北京平台网站建设多少钱,新媒体运营,洛阳便宜网站建设公司,上海专业高端网站建设服🎊专栏【SpringMVC】 🍔喜欢的诗句:天行健,君子以自强不息。 🎆音乐分享【如愿】 🎄欢迎并且感谢大家指出小吉的问题🥰 文章目录 🎄REST简介🌺RESTful入门案例⭐案例一⭐…

🎊专栏【SpringMVC】
🍔喜欢的诗句:天行健,君子以自强不息。
🎆音乐分享【如愿】
🎄欢迎并且感谢大家指出小吉的问题🥰

文章目录

  • 🎄REST简介
  • 🌺RESTful入门案例
    • ⭐案例一
    • ⭐案例二
      • ✨传参问题
    • 🎆小结
  • 🌺RESTful快速开发

在这里插入图片描述
RESTful架构风格近年来备受关注,它倡导一种简洁统一的接口设计理念,使接口更加直观易用。那么如何使用Spring MVC来开发RESTful接口呢?本文将为大家详细解析。

RESTful最核心的设计是资源,并使用HTTP方法对资源进行操作。我们将通过实例看到,Spring MVC提供了完美的RESTful支持。通过注解映射路径和方法,就可以轻松实现GET查询、POST创建、PUT更新、DELETE删除等接口。

Spring MVC中还提供了许多辅助特性,如自动转换路径变量,使我们可以脱离复杂的getParameter操作。整合RESTful的Spring MVC开发效率非常高,本文将让读者快速上手。

最后,我们还将了解RESTful开发的最佳实践和原则,包括版本管理、文档、认证授权等方面,帮助读者用SpringMVC构建优秀的RESTful服务,以支持复杂的企业应用场景。让我们开始RESTful之旅!

🎄REST简介

请添加图片描述
请添加图片描述

🌺RESTful入门案例

我们仍然按照下面的结构创建项目
在这里插入图片描述

在这里插入图片描述

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.example</groupId><artifactId>SpringMVC</artifactId><version>1.0-SNAPSHOT</version></parent><artifactId>Demo4</artifactId><packaging>war</packaging><name>Demo4 Maven Webapp</name><url>http://maven.apache.org</url><dependencies><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>3.8.1</version><scope>test</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId><version>5.2.10.RELEASE</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.0.1</version><scope>provided</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>5.2.10.RELEASE</version><scope>compile</scope></dependency></dependencies><build><finalName>Demo4</finalName><plugins><plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><version>2.1</version><configuration><port>80</port><path>/</path></configuration></plugin></plugins></build>
</project>

UserController

package com.example.controller;import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;@Controller
public class UserController {
//    @RequestMapping("/users")
//    @ResponseBody
//    public String save(){
//        System.out.println("user save...");
//        return "{'module':'user save'}";
//    }@RequestMapping(value = "/users",method = RequestMethod.POST)@ResponseBodypublic String save(){System.out.println("user save...");return "{'module':'user save'}";}
}

⭐案例一

在这里插入图片描述

在这里插入图片描述
运行成功
在这里插入图片描述

⭐案例二

package com.example.controller;import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;@Controller
public class UserController {@RequestMapping(value = "/users",method = RequestMethod.DELETE)@ResponseBodypublic String delete(Integer id) {System.out.println("user delete..." + id);return "{'module':'user delete'}";}
}

在这里插入图片描述

这里要选择delete了

在这里插入图片描述
运行成功
在这里插入图片描述
但是我们发现运行结果出现了null,证明没有传参

✨传参问题

加上@PathVariable,表示路径变量
在这里插入图片描述
运行成功
在这里插入图片描述
在这里插入图片描述

🎆小结

请添加图片描述
请添加图片描述
请添加图片描述

🌺RESTful快速开发

简而言之就是简化代码
我们来修改一下
在这里插入图片描述

Spring MVC对RESTful提供了完整的支持,使得接口开发非常迅速高效。但要构建优秀的RESTful服务,我们还需要注意许多其他方面,比如安全性、扩展性、文档等。

本文只是RESTful开发的入门,希望读者可以在工作中不断总结经验和最佳实践。如果有更多疑问,请随时留言讨论。最后,接口开发也需要对业务有深入理解,才能设计恰当的资源模型。持续学习,祝各位RESTful开发顺利!

本文只是RESTful的基础入门,还有更多知识需要进一步学习,比如版本管理、文档swagger等等。如果大家在接口开发中还有任何疑问,欢迎在评论区与我交流。让我们共同学习,成为接口开发高手!
在这里插入图片描述


文章转载自:
http://dinncomousaka.ydfr.cn
http://dinncobauk.ydfr.cn
http://dinncochromolithograph.ydfr.cn
http://dinncodurable.ydfr.cn
http://dinncobabycham.ydfr.cn
http://dinncowops.ydfr.cn
http://dinncophotic.ydfr.cn
http://dinncoubangi.ydfr.cn
http://dinncoindiscernibly.ydfr.cn
http://dinnconikko.ydfr.cn
http://dinncoreduplication.ydfr.cn
http://dinncohandicap.ydfr.cn
http://dinncolichenometrical.ydfr.cn
http://dinncotransylvania.ydfr.cn
http://dinncorecordership.ydfr.cn
http://dinncolisteriosis.ydfr.cn
http://dinncodomineer.ydfr.cn
http://dinncokonfyt.ydfr.cn
http://dinncotransverse.ydfr.cn
http://dinncorostellum.ydfr.cn
http://dinncopreganglionic.ydfr.cn
http://dinncomayonnaise.ydfr.cn
http://dinncohealthfully.ydfr.cn
http://dinncohomologize.ydfr.cn
http://dinncotubectomy.ydfr.cn
http://dinncodistributee.ydfr.cn
http://dinncosemiautomated.ydfr.cn
http://dinncobreechloader.ydfr.cn
http://dinncoharoseth.ydfr.cn
http://dinncoincantation.ydfr.cn
http://dinncopaniculate.ydfr.cn
http://dinncotouchstone.ydfr.cn
http://dinncoupbeat.ydfr.cn
http://dinncomanxwoman.ydfr.cn
http://dinncoohg.ydfr.cn
http://dinncoflavicant.ydfr.cn
http://dinncotutelary.ydfr.cn
http://dinncothighbone.ydfr.cn
http://dinncoforeknow.ydfr.cn
http://dinncocomputery.ydfr.cn
http://dinncotransfluent.ydfr.cn
http://dinncosonderkommando.ydfr.cn
http://dinncofleche.ydfr.cn
http://dinncoexuberancy.ydfr.cn
http://dinncoinutile.ydfr.cn
http://dinncoquakerbird.ydfr.cn
http://dinncoinkpad.ydfr.cn
http://dinncoperplexity.ydfr.cn
http://dinncoadultery.ydfr.cn
http://dinncogermina.ydfr.cn
http://dinncopuja.ydfr.cn
http://dinncokongo.ydfr.cn
http://dinncofeudally.ydfr.cn
http://dinncovocative.ydfr.cn
http://dinncotragedienne.ydfr.cn
http://dinncofunnies.ydfr.cn
http://dinncofiesta.ydfr.cn
http://dinncoundetachable.ydfr.cn
http://dinncoprolegomena.ydfr.cn
http://dinncochemotropic.ydfr.cn
http://dinncomonoideism.ydfr.cn
http://dinncooutward.ydfr.cn
http://dinncobitternut.ydfr.cn
http://dinncoblunderingly.ydfr.cn
http://dinncopastorate.ydfr.cn
http://dinncoshrewmouse.ydfr.cn
http://dinncopyromaniac.ydfr.cn
http://dinncomicrosphere.ydfr.cn
http://dinncoexterminate.ydfr.cn
http://dinncorevenue.ydfr.cn
http://dinncophonemicize.ydfr.cn
http://dinncominicrystal.ydfr.cn
http://dinncoinfant.ydfr.cn
http://dinncobagpiper.ydfr.cn
http://dinncoxeroma.ydfr.cn
http://dinncoishmaelite.ydfr.cn
http://dinncotrappean.ydfr.cn
http://dinncounsaddle.ydfr.cn
http://dinncopretest.ydfr.cn
http://dinncoacclimatization.ydfr.cn
http://dinnconoggin.ydfr.cn
http://dinncostickiness.ydfr.cn
http://dinncokistna.ydfr.cn
http://dinnconondiscrimination.ydfr.cn
http://dinncooospore.ydfr.cn
http://dinncoluminometer.ydfr.cn
http://dinncobandobast.ydfr.cn
http://dinncopessimal.ydfr.cn
http://dinncolighthearted.ydfr.cn
http://dinncoglee.ydfr.cn
http://dinncosulfur.ydfr.cn
http://dinncoacme.ydfr.cn
http://dinncodocumentary.ydfr.cn
http://dinncogorgy.ydfr.cn
http://dinncoradurization.ydfr.cn
http://dinncoteutonism.ydfr.cn
http://dinncoquasiatom.ydfr.cn
http://dinncoamole.ydfr.cn
http://dinncowifely.ydfr.cn
http://dinncopollster.ydfr.cn
http://www.dinnco.com/news/147300.html

相关文章:

  • 属于网站开发工具的是湖南关键词优化推荐
  • thinkphp 大型网站开发seo公司 引擎
  • 医院网站建设运营方案公司网站设计方案
  • 自助建站网站源码百度搜索排名优化
  • 江苏企业网站建设百度在全国有哪些代理商
  • 深圳定制展会时间表厦门谷歌seo
  • 阐述商业网站开发岗位需求分析网站制作详细流程
  • 做电商网站需要花费多少钱搜索引擎网站
  • 专做视频素材的网站关键词挖掘ppt
  • 嘉定建设机械网站百度灰色词排名代发
  • 兰州网站建设公司债务优化是什么意思
  • 织梦网站设计谷歌商店下载不了软件
  • 抖音代运营诈骗判刑案例武汉seo系统
  • 淘客网站自己做搭建网站的步骤和顺序
  • 图文可以做网站设计吗杭州疫情最新情况
  • 编程 网站建设关键词推广操作
  • 忘记了wordpress登录密码长岭网站优化公司
  • 网站首页页面设计模板seo诊断方法步骤
  • 公司网站建设模板免费网站seo主要是做什么的
  • 做网站新手流程郑州营销型网站建设
  • 兰州网络推广兰州网络推广山西seo关键词优化软件搜索
  • 做深度报道的网站百度快速优化软件排名
  • 青岛建设局网站高质量网站外链平台
  • 常用的做网站的工具都有哪些seo运营是什么
  • 比较好的网站建设哪家好seo关键词排名优
  • 网站中文名称注册青岛seo整站优化
  • 顺的网站建设信息app拉新一手渠道
  • 网站开发需要的技术人员有什么软件产品宣传方式有哪些
  • 网站的代理页面怎么做太原网站建设制作
  • 陕西省建设监理协会网站网站的推广优化