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

javaee spring 用注解的方式实现ioc

spring 用注解的方式实现ioc

spring核心依赖

<?xml version="1.0" encoding="UTF-8"?><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/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>org.example</groupId><artifactId>testSpring03</artifactId><version>1.0-SNAPSHOT</version><packaging>war</packaging><name>testSpring03 Maven Webapp</name><!-- FIXME change it to the project's website --><url>http://www.example.com</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><maven.compiler.source>1.7</maven.compiler.source><maven.compiler.target>1.7</maven.compiler.target></properties><dependencies><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.11</version><scope>test</scope></dependency><!-- 导入spring的核心jar包 --><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>4.3.18.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId><version>4.3.18.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>4.3.18.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>4.3.18.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-expression</artifactId><version>4.3.18.RELEASE</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.1.0</version><scope>provided</scope></dependency></dependencies><build><finalName>testSpring03</finalName><pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --><plugins><plugin><artifactId>maven-clean-plugin</artifactId><version>3.1.0</version></plugin><!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging --><plugin><artifactId>maven-resources-plugin</artifactId><version>3.0.2</version></plugin><plugin><artifactId>maven-compiler-plugin</artifactId><version>3.8.0</version></plugin><plugin><artifactId>maven-surefire-plugin</artifactId><version>2.22.1</version></plugin><plugin><artifactId>maven-war-plugin</artifactId><version>3.2.2</version></plugin><plugin><artifactId>maven-install-plugin</artifactId><version>2.5.2</version></plugin><plugin><artifactId>maven-deploy-plugin</artifactId><version>2.8.2</version></plugin></plugins></pluginManagement></build>
</project>

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:context="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 http://www.springframework.org/schema/context/spring-context.xsd"><!-- 开启注解扫描扫描com.test包以及所有子包中的文件--><context:component-scanbase-package="com.test" />
</beans>
http://www.lryc.cn/news/142576.html

相关文章:

  • Linux基础(二)
  • 155. 最小栈(中等系列)
  • 用python从零开始做一个最简单的小说爬虫带GUI界面(3/3)
  • SpringBoot+Vue如何写一个HelloWorld
  • 深度强化学习。介绍。深度 Q 网络 (DQN) 算法
  • 【C++随笔02】左值和右值
  • 几个nlp的小任务(多选问答)
  • 【C++学习记录】为什么需要异常处理,以及Try Catch的使用方法
  • 孪生网络(Siamese Network)
  • 【Redis】Redis是什么、能干什么、主要功能和工作原理的详细讲解
  • 8月26日,每日信息差
  • 云和恩墨面试(部分)
  • volatile 关键字详解
  • Ceph入门到精通-大流量10GB/s LVS+OSPF 高性能架构
  • Unity光照相关
  • Qt基本类型
  • 前端基础(Element、vxe-table组件库的使用)
  • C++学习记录——이십팔 C++11(4)
  • UE学习记录03----UE5.2 使用拖拽生成模型
  • Spring Cache框架(缓存)
  • Linux学习之Ubuntu 20使用systemd管理OpenResty服务
  • [数据集][目标检测]疲劳驾驶数据集VOC格式4类别-4362张
  • matlab使用教程(25)—常微分方程(ODE)选项
  • MybatisPlus简单到入门
  • 9. 优化器
  • go学习之流程控制语句
  • docker基于已有容器和通过Dockerfile进行制作镜像配置介绍
  • 2022年09月 C/C++(四级)真题解析#中国电子学会#全国青少年软件编程等级考试
  • 二级MySQL(九)——表格数据处理练习
  • QT ListQvector at赋值出错以及解决办法 QT基础入门【QT存储结构】