报这个异常java.lang.ClassCastException: 哪里错了啊

lord_is_layuping lord_is_layuping 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
异常如下:
Exception in thread "main" java.lang.ClassCastException: java.io.FileInputStream
at test.SimpleTest.testQuickStart(SimpleTest.java:18)
at test.SimpleTest.main(SimpleTest.java:26)

源码如下

package test;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.Resource;



import net.xiaxin.spring.qs.Action;


public class SimpleTest {
public void testQuickStart() throws FileNotFoundException {
InputStream is = new FileInputStream("bean.xml");
XmlBeanFactory factory = new XmlBeanFactory((Resource) is);
Action action = (Action) factory.getBean("TheAction");

System.out.println(action.execute("Rod Johnson"));
}

public static void main(String[] args) throws FileNotFoundException {
SimpleTest simpleTest = new SimpleTest();
simpleTest.testQuickStart();
}
}


...全文

相关推荐

评论 10
收藏 已收藏
分享
返回顶部
lord_is_layuping
Java EE 67,535 成员 225,843 内容