2 回答

TA貢獻1797條經驗 獲得超6個贊
該錯誤表明您沒有創建 bean。創建一個 xml bean 配置文件,然后為 downloadProjectRequirementdetails 方法所在的控制器創建 bean!

TA貢獻1911條經驗 獲得超7個贊
此異常是由于 bean 問題造成的。您必須創建一個 xml bean 配置文件,然后為此控制器創建 bean。
您還可能注意到其他一些事情:您正在提供偵聽器 ContextLoaderListener
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
但您沒有為 spring 配置文件提供 context-param 。就像 applicationContext.xml 您必須為您的配置提供以下代碼片段
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>applicationContext.xml</param-value>
</context-param>
如果您提供基于java的spring配置,意味著您當時沒有使用xml文件進行spring配置,您必須提供以下代碼:
<!-- Configure ContextLoaderListener to use AnnotationConfigWebApplicationContext
instead of the default XmlWebApplicationContext -->
<context-param>
<param-name>contextClass</param-name>
<param-value>
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</context-param>
<!-- Configuration locations must consist of one or more comma- or space-delimited
fully-qualified @Configuration classes. Fully-qualified packages may also
be specified for component-scanning -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>com.nirav.modi.config.SpringAppConfig</param-value>
</context-param>
添加回答
舉報