1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.util.spring;
17
18 import java.util.Properties;
19
20 import org.kuali.common.util.PropertyUtils;
21 import org.kuali.common.util.service.DefaultPropertyService;
22 import org.kuali.common.util.service.PropertyService;
23 import org.springframework.beans.factory.FactoryBean;
24
25
26
27
28 @Deprecated
29 public class PropertyFactoryBean extends org.kuali.common.util.property.DefaultPropertyLoadContext implements FactoryBean<Properties> {
30
31 protected static Properties instance;
32 boolean singleton = false;
33 PropertyService service = new DefaultPropertyService();
34 boolean show;
35
36 @Override
37 public Properties getObject() throws Exception {
38 if (isSingleton()) {
39 return getInstance();
40 } else {
41 Properties properties = service.load(this);
42 if (show) {
43 PropertyUtils.info(properties);
44 }
45 return properties;
46 }
47 }
48
49 protected synchronized Properties getInstance() {
50 if (instance == null) {
51 instance = service.load(this);
52 }
53 if (show) {
54 PropertyUtils.info(instance);
55 }
56 return instance;
57 }
58
59 @Override
60 public Class<Properties> getObjectType() {
61 return Properties.class;
62 }
63
64 @Override
65 public boolean isSingleton() {
66 return this.singleton;
67 }
68
69 public void setSingleton(boolean singleton) {
70 this.singleton = singleton;
71 }
72
73 public PropertyService getService() {
74 return service;
75 }
76
77 public void setService(PropertyService service) {
78 this.service = service;
79 }
80
81 public boolean isShow() {
82 return show;
83 }
84
85 public void setShow(boolean show) {
86 this.show = show;
87 }
88 }