【日常笔记】java spring 注解读取文件

获取后缀文件

复制代码
    <!-- 注解读取properties文件开始 @Value("#{configProperties['userPageSize']}")private 
        String userPageSize; -->
    <bean id="configProperties"
        class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="locations">
            <list>
                <value>classpath:/config/*.properties</value>
            </list>
        </property>
    </bean>
    <bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">
        <property name="properties" ref="configProperties" />
    </bean>
    <!-- 注解读取properties文件结束 -->
复制代码

 

posted @   ice.ko  阅读(437)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示