2014-05-04 31 views
1

我有這個映射/列出POST請求的「創建」方法。我做了一個重載的方法「createEmpty()」來嘗試一些東西,但後來被刪除,因爲它爲模糊映射拋出了org.springframework.beans.factory.BeanCreationException。Spring MVC 3:爲不存在的方法找到的模糊映射

問題是,我刪除了所說的方法後,我仍然得到異常。

@Controller 
public class ListsController { 

@RequestMapping(value = "/lists", method = RequestMethod.POST) 
public @ResponseBody List create(@RequestBody List list) { 
    return list; 
} 

信息:開發應用服務器現在運行 可能04 2014年下午4時21分34秒com.google.apphosting.utils.jetty.JettyLogger警告 警告:/:javax.servlet.UnavailableException :org.springframework.beans.factory.BeanCreationException:使用名稱'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0'創建bean時出錯:bean初始化失敗;嵌套異常是java.lang.IllegalStateException:找到模糊映射。無法映射'listsController'bean方法 public tacs.tp.list_sharer.domain.List tacs.tp.list_sharer.web.ListsController.createEmpty() to {[/ lists],methods = [POST],params = [], headers = [],consumes = [],produce = [],custom = []}:已經有'listsController'bean方法 public tacs.tp.list_sharer.domain.List tacs.tp.list_sharer.web.ListsController。創建(tacs.tp.list_sharer.domain.List)映射。 may 04,2014 4:21:34 PM com.google.apphosting.utils.jetty.JettyLogger警告 警告:/:javax.servlet.UnavailableException:org.springframework.beans.factory.BeanCreationException:創建名爲' org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0':bean初始化失敗;嵌套異常是java.lang.IllegalStateException:找到模糊映射。無法映射'listsController'bean方法 public tacs.tp.list_sharer.domain.List tacs.tp.list_sharer.web.ListsController.createEmpty() to {[/ lists],methods = [POST],params = [], headers = [],consumes = [],produce = [],custom = []}:已經有'listsController'bean方法 public tacs.tp.list_sharer.domain.List tacs.tp.list_sharer.web.ListsController。創建(tacs.tp.list_sharer.domain.List)映射。

似乎createEmpty()被緩存的地方......

+0

在你的ListController中是否有'createEmpty'方法? – geoand

+0

當然不是。 mvn clean install修復了這個問題。 – Vallo

回答

4

請儘量做到:
1.如果使用的是Eclipse - 項目 - >清除。
2.如果您正在使用maven,請在部署前嘗試清理和/或安裝項目。



我看你是用碼頭,也許這些鏈接將有助於解決你的問題:
Cleaning up Jetty - Removing 'unnecessaries' things
Jetty runs old war altought mvn clean is run

+0

這不是一個答案,更可能是一個評論。考慮提供一些真正的答案。 –

+0

mvn clean然後mvn install修正了這個問題。謝謝! – Vallo

+0

這也適用於我,但爲什麼? – SinistraD

2

我有同樣的在兩個不同的控制器@RequestMapping價值,我從中移除其中之一,它開始工作正常。