Access Resource
1. ResourceLoader
Spring has a DefaultResourceLoader which can return ClassPathResource, UrlResource, and ServletContextResourceLoader which extends all functions of DefaultResourceLoader.
1 |
|
Spring has a DefaultResourceLoader which can return ClassPathResource, UrlResource, and ServletContextResourceLoader which extends all functions of DefaultResourceLoader.
1 |
|
Junit test:
1 | import org.junit.Test; |
Only one instance in Spring IoC container. Only return the same Bean.
One instance of the bean is created for the entire application.
Two ways to implement, we could learn how Spring work through the code bellow:
1 | package cn.javass.spring.chapter3.bean; |