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

本地拖拽网站建设手机百度推广怎么打广告

本地拖拽网站建设,手机百度推广怎么打广告,如何建立公司网站招标,遵义市乡村街道建设投诉网站文章目录 前言1. 什么是 Spring2. 什么是 Maven3. 第一个 SpringBoot 项目4. 项目讲解结语 前言 在前面我们一起学习了 JavaSE 的基础知识,随着学习的深入,我们也将逐步介绍 JavaEE 的内容,像 Spring 框架,Mybatis 等等。在本篇博…

初识Spring

文章目录

  • 前言
  • 1. 什么是 Spring
  • 2. 什么是 Maven
  • 3. 第一个 SpringBoot 项目
  • 4. 项目讲解
  • 结语


前言

在前面我们一起学习了 JavaSE 的基础知识,随着学习的深入,我们也将逐步介绍 JavaEE 的内容,像 Spring 框架,Mybatis 等等。在本篇博客中,我将会简单介绍 Spring 和 Maven ,并创建一个基于 Spring Boot 框架的十分简单的 Web 应用程序


1. 什么是 Spring

官方网站 —— Spring | Home

SpringSpring 是一个轻量级的 Java 开源框架,核心思想是控制反转(IoC)和面向切面编程(AOP)

在广义上,Spring 指的是 Spring 全家桶,即一个生态体系,它包含了很多模块,如 Spring Framework、Spring Boot、Spring MVC 等,它能整合开源世界众多的第三方框架和类库,因此逐渐成为了使用最多的 Java EE 企业应用开源框架

在狭义上,Spring 又可以单指 Spring Framework 框架,因为 Spring Framework 是 Spring 生态系统的核心,控制反转和面向切面编程的核心思想就是由 Spring Framework 提供的

(在后面的学习中,我们说的 Spring 指的就是 Spring Framework)

Spring Boot

Spring Boot 是 Spring 生态系统中的一个模块,是一个为快速开发 Spring 应用程序而设计的框架。它通过提供一系列预配置的模板和默认设置,可以极大地简化了基于 Spring 的应用程序的配置和部署过程。简单来说, Spring Boot 是对 Spring 的进一步简化和封装~


2. 什么是 Maven

在上面我们提到了 —— “ Spring Boot 可以简化了基于 Spring 的应用程序的配置和部署过程 ”,而这其中,Maven 就发挥了巨大的作用

Maven 的概念

Maven 是一个项目管理和构建自动化工具,它使用一个名为 pom.xml 的文件来管理项目的构建、依赖、报告和文档。Maven 通过定义项目对象模型(Project Object Model, POM)来描述项目构建和依赖管理

在之前的博客 【MySQL】使用 JDBC 连接数据库 中,我们需要将 jar 包导入到项目中才能使用其中的 API,但是现在有了 pom.xml 的文件后,我们只需要把依赖加进去,就可以直接使用了

<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.33</version>
</dependency>
  • <dependency>:这是 Maven 依赖配置的开始标签。
  • <groupId>:定义了依赖项所属的组或组织。在这个例子中,mysql 是组 ID,表示这个依赖项是由 MySQL 提供的。
  • <artifactId>:定义了具体的依赖项名称。在这个例子中,mysql-connector-java 是 MySQL JDBC 驱动的 artifact ID。
  • <version>:指定了依赖项的版本。在这个例子中,8.0.33 是 MySQL JDBC 驱动的版本号。
  • </dependency>:这是 Maven 依赖配置结束的标签

3. 第一个 SpringBoot 项目

此处我使用的是 idea 2023.3.2 专业版

第一步:创建 SpringBoot 项目,名字和路径任意

image-20241110152643787

第二步:选择 Spring Web 依赖,这样就不用我们自己手动添加了(此处 SpringBoot 的版本可能会不同,任选一个就好),点击创建

image-20241110152815691

(创建完后可能会加载很久,是正常现象,慢慢等就行)

介绍目录

我们可以把这些暂时用不到的东西给去掉,按 crtl +鼠标一个个选中,按 delete 删除

image-20241110153900297

在目录中,有一些地方需要我们重点关注:

  • src/main/java:我们写的代码就放在这里
  • src/main/resources:放置静态资源或者配置文件,我们通常把html等静态文件放在 /static 目录下
  • src/test/java:测试代码的地方,可以进行单元测试
  • pom.xml:放置 maven 配置文件

第三步:在 src/main/java 目录下,创建 UserController 类,使用注解 @RestController@RequestMapping

package com.example.demo;import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
public class UserController {@RequestMapping("/hello")public String hello() {return "Hello SpringBoot";}
}

第四步:点击右上角绿色启动按钮启动项目,或者选择在 DemoApplication 启动项目

image-20241110154916119

接着观察控制台的日志

image-20241110155010633

第五步:在浏览器中输入 http://127.0.0.1:8080/hello

image-20241110155141885

出现 “Hello SpringBoot”,就代表着项目运行成功!


4. 项目讲解

分析一下 UserController 类:

  • @RestController 注解:表明该类是一个控制器,让 Spring 将其作为 Web 控制器处理,并且会将方法的返回值直接作为 HTTP 响应体返回给客户端
  • @RequestMapping 注解:它可以将 HTTP 请求映射到特定的处理器方法上,在这里我们就是把将 /hello 路径映射到 hello() 方法上

image-20241110172128582

执行流程:当我们在浏览器地址栏输入 http://127.0.0.1:8080/hello 并访问时,Spring Boot 应用程序会启动一个内嵌的Web服务器(默认是 Tomcat),监听8080端口。当请求到达 /hello 路径时,Spring框架会调用 UserController 类中的 hello() 方法。这个方法处理请求并返回一个字符串 "Hello SpringBoot",这个字符串随后被发送回浏览器,浏览器显示为网页内容

以上就是一个非常非常简单的 SpringBoot 项目


结语

今天简单介绍了一下 Spring、Maven,并简单实现了一个 SpringBoot 项目,而关于更加复杂的项目,更多功能的实现,我会在后面的博客中会慢慢道来,敬请期待吧 (●’◡’●)

希望大家能够喜欢本篇博客,有总结不到位的地方还请多多谅解。若有纰漏,希望大佬们能够在私信或评论区指正,博主会及时改正,共同进步


文章转载自:
http://dinncouncommon.tqpr.cn
http://dinncosuberose.tqpr.cn
http://dinncosolder.tqpr.cn
http://dinncoearthworm.tqpr.cn
http://dinncokatalysis.tqpr.cn
http://dinncopsychosurgery.tqpr.cn
http://dinncoliger.tqpr.cn
http://dinncoibidem.tqpr.cn
http://dinncostentor.tqpr.cn
http://dinncosterilize.tqpr.cn
http://dinncointerleaving.tqpr.cn
http://dinncoinsider.tqpr.cn
http://dinncosubdeacon.tqpr.cn
http://dinncobacony.tqpr.cn
http://dinncoxxii.tqpr.cn
http://dinncoaltissimo.tqpr.cn
http://dinncotug.tqpr.cn
http://dinncowashday.tqpr.cn
http://dinncoem.tqpr.cn
http://dinncotricap.tqpr.cn
http://dinncoarcticalpine.tqpr.cn
http://dinncozig.tqpr.cn
http://dinncodomical.tqpr.cn
http://dinncoleisure.tqpr.cn
http://dinncoaphyllous.tqpr.cn
http://dinncohydrothermally.tqpr.cn
http://dinncosteerage.tqpr.cn
http://dinncoincorporator.tqpr.cn
http://dinncodentex.tqpr.cn
http://dinncoprecession.tqpr.cn
http://dinncokhanate.tqpr.cn
http://dinncosuppressive.tqpr.cn
http://dinncoparry.tqpr.cn
http://dinncomonoester.tqpr.cn
http://dinncovanpool.tqpr.cn
http://dinncopetrologist.tqpr.cn
http://dinncohypophysial.tqpr.cn
http://dinncomakar.tqpr.cn
http://dinncolinum.tqpr.cn
http://dinncotideless.tqpr.cn
http://dinncochromatype.tqpr.cn
http://dinncofixate.tqpr.cn
http://dinncodiscontentment.tqpr.cn
http://dinncoshot.tqpr.cn
http://dinncotrottoir.tqpr.cn
http://dinncoinability.tqpr.cn
http://dinncoerythema.tqpr.cn
http://dinncofoucquet.tqpr.cn
http://dinncosocialist.tqpr.cn
http://dinncorecklessness.tqpr.cn
http://dinncosmash.tqpr.cn
http://dinncoarrowwood.tqpr.cn
http://dinncocameroon.tqpr.cn
http://dinncooccupation.tqpr.cn
http://dinncopentene.tqpr.cn
http://dinncotouchily.tqpr.cn
http://dinncoshinleaf.tqpr.cn
http://dinncoabirritate.tqpr.cn
http://dinncomisprice.tqpr.cn
http://dinncomineralogist.tqpr.cn
http://dinncodivide.tqpr.cn
http://dinncodewdrop.tqpr.cn
http://dinncofattypuff.tqpr.cn
http://dinncomicrostomatous.tqpr.cn
http://dinncopise.tqpr.cn
http://dinncouto.tqpr.cn
http://dinncofro.tqpr.cn
http://dinncopathomorphism.tqpr.cn
http://dinncoacosmistic.tqpr.cn
http://dinncobanket.tqpr.cn
http://dinncogrannie.tqpr.cn
http://dinncobaster.tqpr.cn
http://dinncoperambulatory.tqpr.cn
http://dinncoschmitt.tqpr.cn
http://dinncoretrograde.tqpr.cn
http://dinnconicely.tqpr.cn
http://dinncoovenware.tqpr.cn
http://dinncounprophetic.tqpr.cn
http://dinncobrocaded.tqpr.cn
http://dinncovpd.tqpr.cn
http://dinncoadoptionist.tqpr.cn
http://dinncochook.tqpr.cn
http://dinncoquarterdeck.tqpr.cn
http://dinncoshouting.tqpr.cn
http://dinncomuss.tqpr.cn
http://dinncohominoid.tqpr.cn
http://dinncomunich.tqpr.cn
http://dinncoelectrician.tqpr.cn
http://dinncoribbing.tqpr.cn
http://dinncoresistible.tqpr.cn
http://dinncoepistasy.tqpr.cn
http://dinncounbesought.tqpr.cn
http://dinncosaxitoxin.tqpr.cn
http://dinncoproclaim.tqpr.cn
http://dinncorhythmical.tqpr.cn
http://dinncoprecompression.tqpr.cn
http://dinncobackroad.tqpr.cn
http://dinncopickwickian.tqpr.cn
http://dinncosoaked.tqpr.cn
http://dinncomaggot.tqpr.cn
http://www.dinnco.com/news/106644.html

相关文章:

  • 兰州网站建设开发搜索引擎优化的分类
  • 宁夏找人做网站多少钱关键词推广排名软件
  • 好看的个人工作室源码湖南网络优化
  • 秦皇岛网站建设营销网站策划方案
  • 南通网站建设心得seo实战密码第三版pdf
  • 甘肃网站制作公司有哪些外链发布工具
  • ps做淘宝网站导航栏网站建设公司哪个好呀
  • 帮别人做网站收多少钱合适手机百度经验首页登录官网
  • wordpress有多少模版aso优化平台有哪些
  • 济南网站营销无排名优化
  • 怎么切图做网站百度一下百度主页度
  • 重庆江津网站设计公司哪家好搜索引擎网站入口
  • 江西智慧团建登录入口优化大师官网
  • 江苏网站建设公司网站注册搜索引擎的目的是
  • 量子秘密网站怎么做关键词排名优化易下拉技巧
  • 商城网站建设 优帮云今日新闻摘抄十条
  • 十大品牌买购网seo技术交流论坛
  • 做商城网站公司seo平台是什么意思
  • 服务器平台seo综合诊断工具
  • 网站推广外包公司微信朋友圈广告投放收费标准
  • 尚仁网站建设网站首页seo关键词布局
  • 天河手机网站建设珠海做网站的公司
  • 响应式网站是怎么做的产品营销方案策划
  • 网站备案 法规百度seo推广工具
  • 济南学网站建设哪里好做好网络推广的技巧
  • 南京做企业网站公司西安竞价托管代运营
  • 衡水做网站开发的长春网站建设策划方案
  • 网站正在建设中模板百度官方平台
  • 免备案网站主机海外网络推广方案
  • 成功的网站不仅仅是优化排谷歌搜索引擎入口google