才学习框架,没一点头绪,在网络上找了本《SPRING入门》 夏昕的。。
    但是上面第一个例子就运行不了。。
    各位高手给点意见把

解决方案 »

  1.   

    例子:
    package net.zhenwu.spring.qs;
    public class HelloAction implements Action {
    private String message;
    public String getMessage() {
    return message;
    }
    public void setMessage(String string) {
    message = string;
    }
    public String execute(String str) {
    return (getMessage() + str).toUpperCase();
    }
    }测试类:
    public void testQuickStart() {
    ApplicationContext ctx=new FileSystemXmlApplicationContext("bean.xml");
    Action action = (Action) ctx.getBean("TheAction");
    System.out.println(action.execute("Rod Johnson"));
    }
    配置bean.xml
    <beans>
    <description>Spring Quick Start</description>
    <bean id="TheAction" class="net.zhenwu.spring.qs.HelloAction">
    <property name="message">
    <value>HeLLo</value>
    </property>
    </bean>
    </beans>
    错误提示:java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory我加载了SPRING.JAR包和JDK 包
      

  2.   

    你光加载SPRING.JAR是不够的,还要加载日志相关的包