Spring
共 5 篇文章
Spring利用注解进行多次拦截
最近在用Spring AOP时遇到一个问题。一个切入点会触发两个通知,而切入点是通过注解进行标注的,而注解作为参数传递给通知方法。这样的情况下同时触发两个通知,Spring调用通知方法时传递的注解参数会出现类型错误的问题。 先定义两个注解,Annotation1和Annotation2 @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Inherited @Documented public @interface Annotation1 { String name(); } @Target(ElementType…
2015-08-23 11:43 · Spring
SpringExt 扩展原理
这篇文章是基于webx框架官方文档整理的。具体的请参见webx官方文档。 首先先弄明白在面向对象的设计中比较核心的一个原则——OCP(Open-Closed Principle),也就是开闭原则。 最早描述OCP的是OCP原则的提出者Bertrand Meyer,他在他的著作《Object Oriented Software Construction》中提出了OCP原则:“Software entities should be open for extension,but closed for modification”,也就是“软件实体应当对扩展开放,对修改关闭”。简单点说就是如果原有功能…
Spring整合hibernate配置模版
下面是用一个具体例子写的模版(支持annotation的配置),需要时稍微改改就行: [code="xml"] org.hibernate.dialect.MySQLDialect true com.test.bean.User [/code] [color=darkblue]被注释掉的部分是xxx.hbm.xml配置文件的设置。但是用于annotation的配置同样也可以用与hbm文件配置,[/color][color=red]因为org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean继承了org…
2011-04-12 20:14 · Spring · Spring · XML · Hibernate · ORM · Bean
spring3.0相关jar包的说明
org.springframework.aop- 3.0.0.RELEASE--------------------Spring的面向切面编程,提供AOP(面向切面编程)实现 org.springframework.asm- 3.0.0.RELEASE--------------------Spring独立的asm程序,相遇Spring2.5.6的时候需要asmJar 包.3.0开始提供他自己独立的asmJar org.springframework.aspects- 3.0.0.RELEASE----------------Spring提供对AspectJ框架的整合\ org.spring…
2011-01-03 12:49 · Spring · Spring · JPA · Hibernate · AOP · 编程
【转】Spring加载xml配置文件的几种方法
一:Spring中的几种容器都支持使用xml装配bean,包括: XmlBeanFactory , ClassPathXmlApplicationContext , FileSystemXmlApplicationContext , XmlWebApplicationContext 加载这些容器的配置文件的xml有一下几种常见的方法: 1:引用资源用XmlBeanFactory(不能实现多个文件相互引用) [code="java"] Resource resource = new ClassPathResource("appcontext.xml"); BeanFactory factory…
2010-12-29 23:47 · Spring · Spring · XML · Web · Bean · Servlet