Java

[Relearn Spring] 3 Resource

1. ‘Resource’ is actually a more powerful version of java.net.URL.     What’s more, Spring suggests you use it as a generic utility class, even without Spring. 2. Built-in Implementations.     a.UrlResource     b.ClasspathResource     c.FileSystemResource     d.ServletContextResource     e.InputStreamResource     f.ByteArrayResource

[Relearn Spring] 4 Transaction Management

Annotation based Management   1. Use @Transactional along with <tx:annotaion-driven/>   2. Note: Calling a @Transactional method in the same class will not take effect if you are not using AspectJ for AOP. It’s OK to use HibernateTransactionManager with JdbcTemplate   here it is: 引用 This transaction manager is appropriate for applications that use a …

[Relearn Spring] 4 Transaction Management Read More »

[Relearn Spring] 2.3 IoC – Extension Points

1. BeanPostProcessor       — Do something before of after each bean is instantialized 2. BeanFactoryPostProcessors     –Potentially change the bean’s configuration metadata before the container has instaniated any other beans. 3. FactoryBean — A factory that will create beans by implementing getObject()

[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 »

IOC/DI的好处

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