Hy guys, I am trying to read a properties file and dispay it on the screen, but I am having trouble with my bean filE
Here is my bean file :
<context:property-placeholder location="classpath:fisier.properties." />
<bean id="fisier.properties" class="projectt.proiect.App">
<property name="mesaj" value="${Hello}" />
</bean>
</beans>
MY classes are this:
public class SecondClass {
private String mesaj;
public String getMesaj() {
return mesaj;
}
public void setMesaj(String Mesaj) {
this.mesaj = mesaj;
}
@Override
public String toString(){
return mesaj;
}
}
And the main:
public class App
{
public static void main( String[] args )
{
String confFile = "bean.xml";
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(confFile);
SecondClass secClass = (SecondClass) context.getBean("mesaj");
System.out.println(secClass.toString());
context.close();
}
}
I am getting the following error in the bean file : Attribute : name The name of the property, following JavaBean naming conventions.
Data Type : string
Can someone help me with this?
No comments:
Post a Comment