Dependancy Injection for Date Object doesnt seem to work
here's the code for the xml file
Here's the class:HTML Code:<bean id="date" class="java.util.Date"/> <bean id="obj" class="com.Person.Implementor" autowire="byName"> <property name="username"><value>Abc</value></property> <property name="password"><value>password</value></property> </bean>
The Date reference seems to have the NULL value while printing, it works fine for custom created classes toughHTML Code:package com.Person; import java.util.Date; import org.springframework.beans.factory.annotation.Autowired; public class Implementor { String username; String password; Date date; public Date getDate() { return date; } @Autowired public void setDate(Date date) { this.date = date; } @Override public String toString() { return "Implementor [username=" + username + ", password=" + password + ", date=" + date + "]"; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }


Reply With Quote
