001    package org.kuali.common.util.properties.spring;
002    
003    import org.kuali.common.util.project.ProjectService;
004    import org.kuali.common.util.project.spring.ProjectServiceConfig;
005    import org.kuali.common.util.properties.DefaultPropertiesLocationService;
006    import org.kuali.common.util.properties.PropertiesLocationService;
007    import org.kuali.common.util.spring.env.EnvironmentService;
008    import org.kuali.common.util.spring.service.SpringServiceConfig;
009    import org.springframework.beans.factory.annotation.Autowired;
010    import org.springframework.context.annotation.Bean;
011    import org.springframework.context.annotation.Configuration;
012    import org.springframework.context.annotation.Import;
013    
014    @Configuration
015    @Import({ SpringServiceConfig.class, ProjectServiceConfig.class })
016    public class PropertiesLocationServiceConfig {
017    
018            private static final String CACHE_KEY = "properties.cache";
019            private static final boolean DEFAULT_CACHE_PROPERTIES_VALUE = true;
020    
021            @Autowired
022            EnvironmentService env;
023    
024            @Autowired
025            ProjectService projectService;
026    
027            @Bean
028            public PropertiesLocationService propertiesLocationService() {
029                    boolean cache = env.getBoolean(CACHE_KEY, DEFAULT_CACHE_PROPERTIES_VALUE);
030                    return new DefaultPropertiesLocationService(projectService, cache);
031            }
032    
033    }