内容概要
使用 spring 支持的注解方式,读取系统文件中的配置,注入到容器中,方便调用。
环境jar包
jdk: jdk1.8.0_121(32位)
pom:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.10.RELEASE</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.0.1</version>
</dependency>
文件结构
test.properties 内容
test.txt内容
EL配置类 BeanSpringEl
package SpringEl;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired