- 博客(36)
- 收藏
- 关注
原创 状态模式
允许对象基于内部不同状态而有不同的行为,将每个状态封装成一个类状态模式:Context将行为委托给当前的状态对象,状态改变可以由Context或ConcreteState控制
2012-12-28 15:50:30 167
原创 命令模式
将请求封装成对象,使发出请求的对象和执行请求的对象解耦,命令对象封装了接收者和一个或一组动作,可以支持撤销宏命令是命令的一种简单的延伸,允许调用多个命令,宏方法也可以支持撤销.例子:日志和事务处理
2012-12-28 14:38:17 158
原创 Singleton模式
public class Singleton { private volatile static Singleton uniqueInstance; private Singleton() {} public static Singleton getInstance() { if (uniqueInstance == null) {
2012-12-28 11:14:39 161
原创 装饰者模式
动态的将责任附加到对象上,若要扩展功能,装饰者提供了比继承更有的弹性的替代方案。Decorator既继承于Component【IS A关系】,又维护一个指向Component实例的引用【HAS A关系】.组合【HAS A】Component的目的是让ConcreteDecorator可以在运行时动态给ConcreteComponent增加职责.继承的目的是可以统一装饰者和被装饰者的
2012-12-27 09:15:11 172
原创 profile
a profile instructs Spring to configure only the ApplicationContext that was defined when the specified profile was active.xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation
2012-12-17 12:51:19 219
原创 messageSource
messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> buttons labels ctx.
2012-12-17 12:06:44 169
原创 Executing a Method When a Bean Is Destroyed
Using JSR-250 @PreDestroy AnnotationImplementing the DisposableBean Interfacespecify the name of the methodin the destroy-method attribute of the bean’s tag.Spring calls it just before it des
2012-12-16 23:35:09 175
原创 Execute a Method When a Bean Is Created
The order of executationUsing JSR-250 @PostConstruct AnnotationImplementing the InitializingBean Interfaceinit-method="init"
2012-12-16 23:30:58 176
原创 Bean Inheritance
you don’t want a parent bean definition to become available for lookup from the ApplicationContext, you canadd the attribute abstract="true" in the tag when declaring the parent bean.abstract="tr
2012-12-16 21:03:44 222
原创 Dependency Injection
Dependency Injection also has two common flavors: Constructor Dependency Injectionand Setter Dependency Injection.
2012-12-15 22:26:14 198
原创 Pointcut
JdkRegexpMethodPointcut JdkRegexpMethodPointcut pc = new JdkRegexpMethodPointcut(); pc.setPattern(".*foo1");NameMatchMethodPointcut NameMatchMethodPointcut pc = new NameMatc
2012-12-15 20:20:18 290
原创 advice
A before advice can modify the arguments passed to a method and can prevent the method from executing by raising an exception.after-returning advice cannot modify the return value of a Method Invoca
2012-12-15 19:04:09 209
原创 two kind of proxy for Spring AOP
The CGLIB proxy proxy both classes and interfaces, To use the CGLIB proxy when proxying an interface, you must set the value of the optimize flag in theProxyFactory to true using t
2012-12-15 15:08:16 209
原创 Aop
AspectJ Aop: compile-time weaving modify the actual bytecode of your application good performance complex and flexibleSpring AOP: runtime weaving a subse
2012-12-13 17:20:29 177
原创 Spring in Action 3 - passing parameters to advice
expression="execution(*com.springinaction.springidol.Thinker.thinkOfSomething(String))and args(thoughts)"/>pointcut-ref="thinking"method="interceptThoughts"arg-names="thoughts" />The
2012-12-10 22:15:37 439
原创 Spring in Action 3 - pointcut
Defines an AOP advisor. Defines an AOP after advice (regardless of whether the advised method returns successfully). Defines an AOP after-returning advice. Defines an AOP after-throwing advice.
2012-12-10 22:11:02 272
原创 Spring in Action 3 - pointcut
we used the && operator to combine the execution() and within() designators in an “and” relationshipwe could’ve used the || operator to indicate an “or” relationshipthe ! operator can be used to n
2012-12-10 22:09:30 246
原创 <context:annotation-config />
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://ww
2012-12-08 21:11:09 174
原创 Spring in Action 3 -The four kinds of autowiring
byName—Attempts to match all properties of the autowired bean with beansthat have the same name (or ID) as the properties. Properties for which there’sno matching bean will remain unwired. by
2012-12-08 20:55:42 252
原创 Spring in Action 3 -Spring Expression Language (SpEL)
The ability to reference beans by their ID Invoking methods and accessing properties on objects Mathematical, relational, and logical operations on values Regular expression matching Col
2012-12-08 20:43:22 341
原创 Spring in Action 3 - Spring’s p namespace
Wiring properties with Spring’s p namespacexmlns:p="http://www.springframework.org/schema/p"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.
2012-12-08 20:20:42 238
原创 Spring in Action 3 - the startup lifecycle of a typical bean
the startup lifecycle of a typical bean1 Spring instantiates the bean.2 Spring injects values and bean references into the bean’s properties.3 If the bean implements BeanNameAware, Spring passes
2012-12-08 19:06:00 1596
原创 Spring in Action 3 - application context
ClassPathXmlApplicationContext—Loads a context definition from an XMLfile located in the classpath。--ApplicationContextcontext=new ClassPathXmlApplicationContext("foo.xml");FileSystemXmlApplicat
2012-12-08 19:02:37 281
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人