spring PropertyPlaceholderConfigurer and context:property-placeholder

前端 未结 3 1975
长发绾君心
长发绾君心 2020-11-30 00:35

I have following bean declaration:

  
        

        
3条回答
  •  我在风中等你
    2020-11-30 01:31

    First, you don't need to define both of those locations. Just use classpath:config/properties/database.properties. In a WAR, WEB-INF/classes is a classpath entry, so it will work just fine.

    After that, I think what you mean is you want to use Spring's schema-based configuration to create a configurer. That would go like this:

    
    

    Note that you don't need to "ignoreResourceNotFound" anymore. If you need to define the properties separately using util:properties:

    
    

    There's usually not any reason to define them separately, though.

提交回复
热议问题