我現在有一個應用程序context.cml:豆不自動裝配
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd"
default-autowire="byType">
<context:annotation-config />
<tx:annotation-driven />
<bean class="app.bl.facade.impl.DishFacadeImpl" />
而且我試圖自動裝配它:
@Autowired
private DishFacade dishFacade;
public List<Dish> getEvents() {
System.out.println(dishFacade);
return dishFacade.getAll();
}
結果我被打印出來是null
,我但無法弄清楚爲什麼。
是您的DishFacade也由Spring創建的類嗎? – SMA 2014-10-20 12:52:36
我相信你需要添加'' –
forgivenson
2014-10-20 12:52:38
其中'' –
2014-10-20 12:52:55