MyStringUtil.containsPattern()
public static boolean containsPattern(String text, String regex) { Pattern p = Pattern.compile(regex); Matcher m = p.matcher(text); return m.find(); }
public static boolean containsPattern(String text, String regex) { Pattern p = Pattern.compile(regex); Matcher m = p.matcher(text); return m.find(); }
1. The "singleton " scope is not "singleton per class", but "singleton per bean" 2. A bean can inherit another one, which is supposed to be declared as "abstract"
把主对象建好之后,再通过容器注入它的从属对象。 这是一种解耦: 1.主对象的构造不依赖于从属对象。 2.主对象不用考虑去哪找从属对象,容器会处理好这件事。
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, …
1. Core(Ioc Container) 2. Context 3. DAO 4. ORM 5. AOP 6. JEE (JMX,JMS,JCA,Email…) 7. Web
中国的网银的用户体验普遍比较差,这可能跟银行没有专门做软件的产品经理有关。 如果说这个还可以容忍,那各种BUG就很恶心了。 某行的网银用的是C/S程序,我一次登录时,死活登录不上,老说我密码不对;后来用另一台电脑登录,就登上了。 今天遇到的这个更搞笑。这是另一家著名银行网银给我的错误提示: "对不起,操作未成功!role.user_has_not_right_status "
以 <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”
非常轻量,而且可以跟Spring集成。 据说还有人搞出了相关的Annotation,这样一来真的可以对任何对象透明地进行缓存。
把源代码和单元测试的class文件丢在同一个目录里并不是个好主意。 为了配置单元测试的class的地址, 可以 右击 单元测试的source folder(如test/src) -> Build Path -> Config output folder.
开发/测试一个 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 …