Announcement Announcement Module
Collapse
No announcement yet.
NullPointerException while Injection below sources, how to use a ref tag Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    You want to read some properties from a property file?

    http://static.springsource.org/sprin...lderconfigurer

    Comment

    Working...
    X