Spring IOC 容器源码分析 - omigaw/spring- GitHub Wiki

原文链接:https://javadoop.com/post/spring-ioc

启动Spring容器的例子

`public static void main(String[] args){
     ApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationfile.xml");
 }`
以上代码就可以利用配置文件来启动一个Spring容器了,使用maven的小伙伴直接在dependencies中加上依赖即可,个人比较反对那些不知道要添加什么依赖,然后把Spring的所有相关的东西都加进来的方式。
`<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>4.3.11.RELEASE<version>
 </dependency>`

spring-context会自动将spring-core、spring-beans、spring-aop、spring-expression这几个jar包带进来。

⚠️ **GitHub.com Fallback** ⚠️