2014-04-01 29 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"); 
相關問題