jar包下载

2018-06-25  本文已影响0人  Wide_Star

spring所需jar包:


spring官网:(http://spring.io/)


spring开发包下载地址


spring的spring-framework-3.0.2.RELEASE-dependencies.zip包的下载地址:
http://s3.amazonaws.com/dist.springframework.org/release/SPR/spring-framework-3.0.2.RELEASE-dependencies.zip


spring IOC

spring IOC基础包6个:
4个核心包:
\spring-framework-4.3.9.RELEASE\libs\spring-beans-4.3.9.RELEASE.jar
\spring-framework-4.3.9.RELEASE\libs\spring-context-4.3.9.RELEASE.jar
\spring-framework-4.3.9.RELEASE\libs\spring-core-4.3.9.RELEASE.jar
\spring-framework-4.3.9.RELEASE\libs\spring-expression-4.3.9.RELEASE.jar
两个日志包:
1.日志规范包:
\spring-framework-3.0.2.RELEASE-dependencies\org.apache.commons\com.springsource.org.apache.commons.logging\com.springsource.org.apache.commons.logging-1.1.1.jar
2.日志实现包:
\spring-framework-3.0.2.RELEASE-dependencies\org.apache.log4j\com.springsource.org.apache.log4j\com.springsource.org.apache.log4j-1.2.15.jar


如果是使用注解方式玩转spring IOC则主要在6个核心包的基础上加上一个aop的jar包:
\spring-framework-4.3.9.RELEASE\libs\spring-aop-4.3.9.RELEASE.jar


spring核心配置文件:applicationContext.xml采用schema约束,约束文件所在位置:
\spring-framework-4.3.9.RELEASE\docs\spring-framework-reference\html\xsd-configuration.html

  1. 使用IOC配置文件的方式则需要引入schema约束xsd-configuration.html文件中的
    41.2.12 the beans schema
  2. 使用IOC注解的方式则需要引入schema约束xsd-configuration.html文件中的
    41.2.8 the context schema
    在联网的情况下根据引入的约束的命名空间可以提示,但是在没有联网的情况下需要加载本地约束来获得提示,具体步骤:
    注解形式下需要加载beans和context:
    window--preferences--xml catalog--Add--
    location:\spring-framework-4.3.9.RELEASE\schema\beans\版本最高的xsd文件
    key type:schema location
    key:http://www.springframework.org/schema/beans/spring-beans.xsd

window--preferences--xml catalog--Add--
location:\spring-framework-4.3.9.RELEASE\schema\context\版本最高的xsd文件
key type:schema location
key:http://www.springframework.org/schema/context/spring-context.xsd


常用注解:
类的注解
@component(value="id值");
分层:
web层:@Controller
业务层:@Service
持久层:@Repository

属性注入的注解
注入数值型的属性
@Value(value="id值")
注入引用类型的数据:
@AutoWired:按类型注入,与ID值无关,不推荐单独使用,和Qualifier一起使用可以按id值注入
@Qualifier(value="id值")

@Resource(name="id值") 是java的注解,spring框架支持该注解,相当于@AutoWired和@Qualifier(value="id值")以为使用

配置类的单例多例:
@Scope(value="singleton")
@Scope(value="prototype")

配置生命周期:
@PostConstruct相当于init-method()
@PreDestroy相当于destroy-method()

整合JUnit单元测试
导入jar包:
@RunWith(SpringJunit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
将要使用的类生命为私有属性:
@Resource(name="id值")
private T name; 下面就可以直接使用该类


Spring IOC现在共用到了8个包:4个核心包,2个日志包,一个整合JUnit4J的测试包,还有一个提供注解方式的aop包。


spring AOP

共用到4个包:
spring的aop包:
\spring-framework-4.3.9.RELEASE\libs\spring-aop-4.3.9.RELEASE.jar
spring的aop和aspectj的整合包:
\spring-framework-4.3.9.RELEASE\libs\spring-aspects-4.3.9.RELEASE.jar
aop联盟的开发规范包:
\spring-framework-3.0.2.RELEASE-dependencies\org.aopalliance\com.springsource.org.aopalliance\com.springsource.org.aopalliance-1.0.0.jar
aspectj包:
\spring-framework-3.0.2.RELEASE-dependencies\org.aspectj\com.springsource.org.aspectj.weaver\com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar

上一篇下一篇

猜你喜欢

热点阅读