1. struts2配置文件依賴注入參數對應的action類的相應屬性是null怎麼辦
問題就出在get方法中,struts2是基於依賴注入的,因此struts2內部已經提供了自動注入機制了,就不需要通過ServletActionContext.getServletContext().getRealPath獲取所注入的值,將get方法改為public String getSavePath() throws Exception{
return savePath;
}
就OK了,望採納!
2. SpringBoot項目使用@PropertySource註解載入properties配置文件,但輸出對象值為null
不是要加上前綴?
@ConfigurationProperties(prefix = "Example")
@PropertySource("classpath:my.properties")//這是屬性文件路徑