找不到错误,代码正确,和书上一样,但是运行不出来界面

问题遇到的现象和发生背景

代码没有错误,运行结果确不对,结果如下:

img


最基础的一个spring项目,代码结构如下:

img

运行结果及报错内容

这是控制台显示的内容,不确定是不是这里错了

img

书上讲的是运行完下面的main函数,控制台会输出“Hello,study hard!”,结果是运行完报错了

package test;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import dao.TestDao;

public class test {
    public static void main (String[] args) {
        //初始化Spring容器ApplicationContext,加载配置文件
        ApplicationContext appCon = new ClassPathXmlApplicationContext("applicationContext.xml");
        //通过容器获取text实例
        TestDao tt=(TestDao)appCon.getBean("test");//text为配置文件中的id
        tt.sayHello();
    }

}

运行main函数是应用程序,不能通过网页访问。运行后在控制台(Console)查看结果。