Reading value from Spring Property file

Here is my code I'm trying to read " TestMe variable from My.properties file.

public class TestToCheckProperties {

    private int testMe;

      public void setTestMe(int testMe) {
    this.testMe = testMe;
        }

    public static void main(String args[]){
        ApplicationContext context = new ClassPathXmlApplicationContext("classpath:/META-INF/spring/bean/dfp-web-beans.xml");
        TestToCheckProperties testToCheckProperties=context.getBean(TestToCheckProperties);
        System.out.println("testMe: "+testToCheckProperties.testMe);
}

This is in my Spring.XML I've created a bean for class TestToCheckProperties:

<bean id='TestToCheckProperties' class="com.My.Code.TestToCheckProperties"  >
        <property name="testMe" value="${My.code.TestToCheckProperties}" />
    </bean>

This is in my My.Property file and I'm trying to read this value in my class:

#TestToCheckProperties
My.code.TestToCheckProperties=10 

Here is the error I'm getting

Answers


The statement:

TestToCheckProperties testToCheckProperties = 
    context.getBean(TestToCheckProperties);

is invalid. It should rather be:

TestToCheckProperties testToCheckProperties = 
    (TestToCheckProperties) context.getBean("TestToCheckProperties");

Need Your Help

Knockout.js and nulls

jquery rest null knockout.js knockout-mapping-plugin

I'm using a combination of Knockout.js + the Knockout mapping plugin + jQuery in a rich web client that consumes JSON from a RESTful API.

How do you post data to joined tables - Using EF 5, ASP.NET MVC 4

asp.net-mvc entity-framework asp.net-mvc-4 join entity-framework-5

I am new to MVC 4 and up to this point I have been retrieving data from one table and saving back to the same table. Now I have data from joined tables and need to save back to the same joined tabl...