HTML Code 

1
2
3
4
5
6
7
8
9
10


<bean id="ckcPlaceholderProperties" class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:default.properties</value>
            </list>
        </property>
        <property name="order" value="2"></property>
        <property name="ignoreUnresolvablePlaceholders" value="true" />
</bean>
<bean id="pathConfig" class="com.movitech.erms.business.configuration.PathConfig"/>

 HTML Code 

1
2
3
4


# default.properties file content
local.p_w_upload.path=1
p_w_upload.resume.path=2
interview.p_w_upload.path=D:\My Document

 Java Code 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29


/**
 *  PathConfig 注入的类文件
 *
 * @author Tony.Wang
 * @time 2014/4/28 0028 17:31
 */

public class PathConfig {

    @Value("${local.p_w_upload.path}")
    private String localAttachmentPath;

    @Value("${p_w_upload.resume.path}")
    private String p_w_uploadResumePath;

    @Value("${interview.p_w_upload.path}")
    private String interviewAttachmentPath;

    public String getLocalAttachmentPath() {
        return localAttachmentPath;
    }

    public String getInterviewAttachmentPath() {
        return interviewAttachmentPath;
    }

    public String getAttachmentResumePath() {
        return p_w_uploadResumePath;
    }
}

 Java Code 

1
2


@Resource
private PathConfig pathConfig;