001 package org.kuali.common.util.spring.config;
002
003 import java.util.ArrayList;
004 import java.util.Arrays;
005 import java.util.List;
006 import java.util.Properties;
007
008 import org.kuali.common.util.PropertyUtils;
009 import org.kuali.common.util.property.Constants;
010 import org.kuali.common.util.property.processor.ProjectProcessor;
011 import org.kuali.common.util.property.processor.PropertyProcessor;
012 import org.kuali.common.util.property.processor.VersionProcessor;
013 import org.springframework.beans.factory.annotation.Autowired;
014 import org.springframework.beans.factory.annotation.Qualifier;
015 import org.springframework.context.annotation.Bean;
016 import org.springframework.context.annotation.Configuration;
017 import org.springframework.core.env.PropertiesPropertySource;
018
019 @Configuration
020 public class ProjectPropertiesConfig {
021
022 @Autowired
023 @Qualifier(Constants.DEFAULT_MAVEN_PROPERTIES_BEAN_NAME)
024 Properties mavenProperties;
025
026 @Bean
027 public PropertiesPropertySource projectPropertySource() {
028
029 List<PropertyProcessor> processors = new ArrayList<PropertyProcessor>();
030 processors.add(new ProjectProcessor());
031 processors.add(new VersionProcessor(Arrays.asList("project.version"), true));
032 PropertyUtils.process(mavenProperties, processors);
033
034 String name = Constants.DEFAULT_MAVEN_PROPERTIES_BEAN_NAME;
035 return new PropertiesPropertySource(name, mavenProperties);
036 }
037 }