Spring工程搭建
2024-10-08 11:57:29
创建Maven项目
1.下载Maven资源包
http://maven.apache.org/download.cgi
2.打开IDEA创建Maven项目
在新建项目窗口选择Maven项目:检查当前SDK版本是否为最新版本。
配置Maven
1.修改Maven home directory的路径
- File——Settings...打开设置
- 搜索Maven
- 改路径
搭建配置引入依赖:
- Maven仓库查询链接:mvnrepository
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.2.13.RELEASE</version>
</dependency> <!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.2.13.RELEASE</version>
</dependency> <!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.2.13.RELEASE</version>
</dependency> <!-- https://mvnrepository.com/artifact/org.springframework/spring-expression -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>5.2.13.RELEASE</version>
</dependency> <!-- https://mvnrepository.com/artifact/org.springframework/spring-aop -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>5.2.13.RELEASE</version>
</dependency> <!-- https://mvnrepository.com/artifact/org.springframework/spring-jcl -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jcl</artifactId>
<version>5.2.13.RELEASE</version>
</dependency> </dependencies>
刷新Maven
代码截屏:
1.接口类
2.实现类
3.实现接口
4.测试类的方法
5.测试结果
步骤:
1、新建UserService接口
2、新建UserService实现类
3、通过bean将UserService放入容器
4、通过context的getbean方法拿到UserService对象
最新文章
- 把office文档转换为html过程中的一些坑
- windows和linux之间“/”, ";\\";的区别
- 专业上的常用的工具和类库集 By 老衣
- 初学SQL常用到的一些指令
- 会php不回缓存行吗?多重实现
- Android之ScaleGestureDetector(缩放手势检测)
- [读书笔记]算法(Sedgewick著)&#183;第二章.初级排序算法
- Orchard是一个了不起CMS(内容管理系统)
- java对数据库的操作
- Linux下进程间通信--共享内存:最快的进程间通信方式
- 尝试解决IDea 启动项目后,后台疯狂输出日志。
- 2018-软工机试-F-庙会
- 第一次:lesson eighty seven。
- Lucene源码
- 【题解】 bzoj1055: [HAOI2008]玩具取名 (动态规划)
- ECG心电图数据2
- 苏宁易购Android架构演进史
- 重构--去除丑陋的switch语句
- Lua库-bit32库
- C# 类反射创建对象实例