Spring Web アプリケーションを開発しましたが、正常に動作しています。次のようなBean作成マッピング構造があります:私のコントローラー:
@Controller
@RequestMapping("appointmentDiary")
public class AppointmentDiaryController {
private IAppointmentDiaryService appointmentDiaryService;
public IAppointmentDiaryService getAppointmentDiaryService() {
return appointmentDiaryService;
}
public void setAppointmentDiaryService(IAppointmentDiaryService appointmentDiaryService) {
this.appointmentDiaryService = appointmentDiaryService;
}
}
My Service Interface:
public interface IAppointmentDiaryService
{
public Integer getAppointmentDiaryNo();
}
My Impl Class:
public class AppointmentDiaryServiceImpl implements IAppointmentDiaryService{
private IAppointmentDiaryDAO appointmentDiaryDAO;
public IAppointmentDiaryDAO getAppointmentDiaryDAO(){
return appointmentDiaryDAO;
}
public void setAppointmentDiaryDAO(IAppointmentDiaryDAO appointmentDiaryDAO) {
this.appointmentDiaryDAO = appointmentDiaryDAO;
}
public Integer getAppointmentDiaryNo(){
InternalResultsResponse<Object> objResponse = getAppointmentDiaryDAO().getAppointmentDiaryNo();
return objResponse;
}
My DAO Interface:
public interface IAppointmentDiaryDAO extends IGenericDAO
{
public InternalResultsResponse<Object> getAppointmentDiaryNo();
}
My DAO Impl calss:
public class AppointmentDiaryDAOImpl extends GenericDAOImpl implements
IAppointmentDiaryDAO {
public InternalResultsResponse<Object> getAppointmentDiaryNo() {
InternalResultsResponse<Object> response = new InternalResultsResponse<Object>();
String sql = SqlProperties.getSQLStatement("getAppointmentDiaryNo");
Session session = getSession();
Transaction tr = session.beginTransaction();
response = HibernateUtil.executeSQLQuery(session, sql);
tr.commit();
return response;
}
}
ここで、この構造を使用したくありません。すべてのサービス インターフェイス、Impl クラス、DAO インターフェイス、および Impl クラスの jar ファイルを作成したいと考えています。これは、コントローラー以外のすべてが jar ファイルにある必要があることを意味します。しかし、jarファイルを作成し、プロジェクトのクラスパスを追加してプロジェクトを実行すると、例外が発生しました:例外は:
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [com.nmmc.cess.service.impl.AppointmentDiaryServiceImpl] for bean with name 'appointmentDiaryServiceImpl' defined in ServletContext resource [/WEB-INF/config/cess-service-application-context.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: com/nmmc/cess/service/IAppointmentDiaryService
では、Spring によって xml ファイルで定義された Bean をマップするように構成するにはどうすればよいでしょうか。そのjarファイルを使用せずにプロジェクトを実行すると、Bean構成が正常に機能します。解決策を教えてください。前もって感謝します。