-
Jan 12th, 2012, 12:38 AM
#1
NullPointerException while Injection below sources, how to use a ref tag
How to Injection when there are below Glo.java sources.
this is my configuration.
---------------------------context.xml------------------------
<bean id="glo" class="com.core.Glo">
<property name = TYPE1 value="TEST.getproperty("test.type")"
</bean>
--> I want to fix the value of "TEST.getproperty("test.type")"
---------------------Glo.java-------------
public class Glo {
public static final String TYPE1 = TEST.getProperty("test.type");
}
--------------------TEST.java-----------
public class TEST{
public static String getProperty(String key){
FileInputStream fis = null;
Properties props = new Properties();
fis = new FileInputStream("gol.properties");
props.load(new java.io.BufferedInputStream(fis));
return props.getProperty(keyName).trim();
}
}
---------------glo.properties-------------
test.type = 1
test.type2 = 2
-
Jan 12th, 2012, 02:59 AM
#2
You want to read some properties from a property file?
http://static.springsource.org/sprin...lderconfigurer
Amila Domingo
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules