2014-04-01 32 views
0

我遇到一些麻烦NoSuchBeanDefinitionException ...是否有可能调试类型没有唯一的bean定义发现0

这里是我的类:

package fr.aaaa; 
@Component 
public class Computation { 
    static Logger logger = Logger.getLogger(Computation.class); 

    public Computation() { 
    } 

    public static void main(String[] args) { 
     ApplicationContext context = new ClassPathXmlApplicationContext("classpath*:applicationContext.xml"); 
     Computation computer = context.getBean(Computation.class); 
    } 
} 

我applicationContext.xml文件位于在src/main/resources/com/acc/resources/。 我将它复制到src/main/resources/中,没有引发更多异常。

如何更改类路径以使Spring能够在src/main/resources/com/acc/resources/中找到xml文件?

+0

'类路径:COM/ACC /资源/ applicationContext.xml' – superEb

回答

0

你需要指定路径:

... ClassPathXmlApplicationContext("classpath*:com/acc/resources/applicationContext.xml"); 
相关问题