Anton Anton - 1 year ago 127
Java Question

Spring - cannot resolve test class in beans.xml

I'm quite new to Spring framework so this question may look dumb a bit

I'm trying to create abstract class

package and configure it with Spring
file. This file is in
package and looks like:


... schema URLs ...

<bean abstract="true" id="test" class="Test" />


Inspection says:

Cannot resolve class 'Test'

Idea politely offers me to create
. I agreed and it has been created in
package. But it's a bit messy. I do not want it to be there.

Code of Test.class:

@ContextConfiguration(locations = {"/configuration.xml"})
public abstract class Test {

abstract void test();


What do I miss?

Answer Source

It turned that resource folder matters. Initially configuration.xml was created in resources folder of main package, then moved to resources folder of test package. That is the reason of such behavior. After configuration.xml deleting, resources folder remarking and new configuration.xml creating in resources folder of test package issue was resolved.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download