当前位置: 代码迷 >> J2EE >> spring 治理bean,能否new对象
  详细解决方案

spring 治理bean,能否new对象

热度:109   发布时间:2016-04-21 21:54:15.0
spring 管理bean,能否new对象
dao层引用了一个对象
public List getRptHead(String rno)throws Exception {
// TODO Auto-generated method stub
return TableHeade.getHead(rno);
}

在这个TableHeade类中有一个静态方法:getHead(rno);
方法

public static List getHead(String rno)
throws Exception
{DBManage db = new DBManage();}

当执行getHead(String rno)方法的时候报错
java.lang.NoClassDefFoundError: com/aaa/bbb/util/DBManage
cn.sundatasoft.util.TableHeade.getHead(TableHeade.java:27)
cn.sundatasoft.ibatis.dao.rpt.impl.ReportDaoImpl.getRptHead(ReportDaoImpl.java:14)
cn.sundatasoft.rpt.service.impl.ReportServiceImpl.getRptHead(ReportServiceImpl.java:17)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
$Proxy9.getRptHead(Unknown Source)
cn.sundatasoft.rpt.action.ReportAction.execute(ReportAction.java:30)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
不能new 这个DBManage吗?
不想通过spring来管理DBManage


------解决方案--------------------
不配置就不会管理的,好像错误时没找到类文件哦。
  相关解决方案