SpringMVC通过@Value读取配置文件

Posted 没有梦想-何必远方

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SpringMVC通过@Value读取配置文件相关的知识,希望对你有一定的参考价值。

  • spring中配置:
<bean id="configProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="locations">
            <list>
                <value>
                    classpath:other.properties
                </value>
            </list>
        </property>
    </bean>
  • 注入
@Value("#configProperties['epack.url']")
    private String epackURL;

以上是关于SpringMVC通过@Value读取配置文件的主要内容,如果未能解决你的问题,请参考以下文章