你好下面是場景構造函數拋出異常嵌套的例外是顯示java.lang.NullPointerException
@Component
public class DateFormatter() {
public String DateToString() {
//some Logic;
}
}
public class DataProvider{
@Resource("dateFormatter")
private DateFormatter dateFormatter;
public void test(){
Date date = new Date();
String formattedDate = this.dateFormatter(date);
system.out.print("Formatted Date is :" + formattedDate);}
}
構造函數拋出異常嵌套的例外是顯示java.lang.NullPointerException是我我的控制檯上看到
有沒有堆棧跟蹤?它應該告訴你哪個構造函數爲nullpointered。此外,你在這裏發佈的代碼中沒有包含一個構造函數,它可能會導致nullpointer ... –
'公共類DateFormatter(){'不能在第一時間編譯 – A4L
請格式化您的代碼,使其易讀。 –