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

Spring的创建

文章目录

  • 前言

  • 一、创建一个Maven项目
  • 二、添加spring框架支持

    2.1在项目的pom.xml添加spring框架支持,xml配置如下 

    2.2添加包

  • 总结


前言

我们通常所说的 Spring 指的是 Spring Framework(Spring 框架),它是⼀个开源框架,有着活跃⽽庞⼤的社区,这就是它之所以能⻓久不衰的原因。Spring ⽀持⼴泛的应⽤场景,它可以让 Java 企业级的应⽤程序开发起来更简单。
⽤⼀句话概括 Spring:Spring 是包含了众多⼯具⽅法的 IoC 容器


一、创建一个Maven项目

然后下一步就是点击next和finish即可

二、添加spring框架支持

2.1在项目的pom.xml添加spring框架支持,xml配置如下

   <dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>5.2.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>5.2.3.RELEASE</version>
    </dependency>
</dependencies>

2.2添加包

在resource中加入一个spring-config.xml的包(可以自由命名)。

Spring 配置⽂件的固定格式为以下内容(以下内容⽆需记忆,只需要保存到⾃⼰可以找到的地⽅就可以了,因为它是固定不变的)
 

代码如下(示例):

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:content="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
</beans>


总结

ok,创建好了,欢迎评论


http://www.kler.cn/news/155551.html

相关文章:

  • 【滑动窗口】水果成篮
  • Python如何优雅地使用重试:tenacity
  • C++11——initializer_list
  • 初识主力投资者
  • Linux MeterSphere一站式开源持续测试平台远程访问
  • JavaSE学习路线及经验所谈
  • selenium使用记录
  • 1949-2021年全国31省公路里程数据
  • Docker容器(一)概述
  • Python安装步骤介绍
  • LeetCode 每日一题 Day1
  • 软件工程导论学习资料
  • 7.24 SpringBoot项目实战【审核评论】
  • 音乐播放器Swinsian mac功能介绍
  • 提权(2), Netcat反弹shell
  • html页面多个视频标签时设定只能播放一个视频
  • 视频智能分析国标GB28181云平台EasyCVR加密机授权异常是什么原因?
  • Java数据结构 之 包装类简单认识泛类
  • 操作系统进程与线程篇
  • 【Unity动画】什么是动画蒙版(Avatar Mask)
  • 【面试经典 150 | 二分查找】搜索插入位置
  • 【STL】手撕 string类
  • Python练习题(二)
  • re:Invent 构建未来:云计算生成式 AI 诞生科技新局面
  • IO_D3(231205)
  • Python datetime 字符串 相互转 datetime
  • C#网络编程System.Net.WebClient 类vs System.Net.Http.HttpClient 类
  • windows下docker环境搭建与运行实战
  • UCore-OS实验Lab0
  • 说一说MySQL中的锁机制