1 package org.kuali.common.jdbc.vendor.spring;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import org.kuali.common.jdbc.project.spring.JdbcProjectConfig;
7 import org.kuali.common.jdbc.project.spring.JdbcPropertyLocationsConfig;
8 import org.kuali.common.util.project.ProjectUtils;
9 import org.kuali.common.util.project.model.Project;
10 import org.kuali.common.util.properties.Location;
11 import org.kuali.common.util.properties.PropertiesService;
12 import org.kuali.common.util.properties.spring.DefaultPropertiesServiceConfig;
13 import org.kuali.common.util.spring.PropertySourceUtils;
14 import org.kuali.common.util.spring.service.PropertySourceConfig;
15 import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.context.annotation.Bean;
17 import org.springframework.context.annotation.Configuration;
18 import org.springframework.context.annotation.Import;
19 import org.springframework.core.env.PropertySource;
20
21 @Configuration
22 @Import({ JdbcProjectConfig.class, JdbcPropertyLocationsConfig.class, DefaultPropertiesServiceConfig.class })
23 public class ShowPropertySourceConfig implements PropertySourceConfig {
24
25 @Autowired
26 JdbcPropertyLocationsConfig jdbc;
27
28 @Autowired
29 Project project;
30
31 @Autowired
32 PropertiesService service;
33
34 @Override
35 @Bean
36 public PropertySource<?> propertySource() {
37 List<Location> locations = new ArrayList<Location>(jdbc.jdbcPropertyLocations());
38 locations.add(new Location("classpath:jc.properties", ProjectUtils.getEncoding(project)));
39 return PropertySourceUtils.getPropertySource(service, locations);
40 }
41 }