创建了grails 2.3.7 rest应用程序,其中控制器中未发生服务的自动装配,下面是controller和service的代码,都在grails-app文件夹下,下面是目录结构的链接。
package com.peelworks
class OneSFController extends grails.rest.RestfulController{
OneSFService oneSFService;
static responseFormats = ['json'];
def List<Salesman> getSalesMan(){
return oneSFService.getSalesMan(); // this is where
the oneSFService is null
}
}
- Service code
package com.peelworks
import com.peelworks.dao.OneSFDAO
class OneSFService {
OneSFDAO oneSFDAO;
List<Salesman> getSalesMan(){
return oneSFDAO.getSalesMan(); // here the onseSFDAO is also null
}
}