Month: April 2010

IOC/DI的好处

   把主对象建好之后,再通过容器注入它的从属对象。    这是一种解耦:      1.主对象的构造不依赖于从属对象。      2.主对象不用考虑去哪找从属对象,容器会处理好这件事。

[Relearn Spring] 2.1 IoC – Misc 1

1. BeanFactory V.S. ApplicationContext   BeanFactory only handles the managements of beans.   ApplicaitonContext is build upon BeanFactory (by inheritance) but add enterprise support to it, such as AOP/Resource etc. 2. BeanDefinition will hold the metadata for beans, such as  scope, lazy-initialization and so on. 3. You can use your self-defined to create your bean, …

[Relearn Spring] 2.1 IoC – Misc 1 Read More »

中国各银行有没有真正靠的住的网银?

中国的网银的用户体验普遍比较差,这可能跟银行没有专门做软件的产品经理有关。 如果说这个还可以容忍,那各种BUG就很恶心了。 某行的网银用的是C/S程序,我一次登录时,死活登录不上,老说我密码不对;后来用另一台电脑登录,就登上了。 今天遇到的这个更搞笑。这是另一家著名银行网银给我的错误提示: "对不起,操作未成功!role.user_has_not_right_status "  

Autowire一个 FactoryBean时,代码里要把变量的类型定义为FactoryBean.getObjectType()

以   <bean id="myCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> 为例, //正确 @Autowired private Ehcache myCache; //因为 EhCacheFactoryBean.getObjectType() == Ehcache //错误: @Autowired private Cache myCache; //会报错,虽然Cache是Ehcache的子类。具体错误为“No unique bean of type [net.sf.ehcache.Cache] is defined”

Ehcache is good!

非常轻量,而且可以跟Spring集成。 据说还有人搞出了相关的Annotation,这样一来真的可以对任何对象透明地进行缓存。

[MVC]分解一个Action/Controller的功能点/测试点

开发/测试一个 Struts Action/Spring Controller时,要注意覆盖到以下所有功能点/测试点.   1.Form Rendering         a.first rendering      b.rendering after submission         i.successful submission        ii.failed submission   2.Validation      a.Show Field Errors/Action Errors in validation fails   3.Show Correct Results      a. What if no result?      b. Results are too few to be paginated.      c. Results are so many …

[MVC]分解一个Action/Controller的功能点/测试点 Read More »