ApplicationContext ctx = new FileSystemXmlApplicationContext错误

时间:2010-04-22 09:32:30

标签: java spring

您好我是Java新手,很抱歉,如果我的问题听起来有点愚蠢。

我正在关注hibernate的教程,我正在尝试从文件系统中获取上下文定义文件。

ApplicationContext ctx  = new FileSystemXmlApplicationContext(
        new String[] { "conf/rssWebApplication-services.xml",
        "conf/rssWebApplication-data-hibernate.xml" });

但我收到以下错误:

found   : org.springframework.context.support.FileSystemXmlApplicationContext
required: org.jboss.weld.context.ApplicationContext
        ApplicationContext ctx  = new FileSystemXmlApplicationContext(
                new String[] { "conf/rssWebApplication-services.xml",

知道这是什么问题吗?

由于

1 个答案:

答案 0 :(得分:2)

导入ApplicationContext是错误的 - 修复它,指向spring ApplicationContext。 (目前,它来自Weld框架)。所以:

org.springframework.context.ApplicationContext

而不是

org.jboss.weld.context.ApplicationContext