Mordechai,
Consider the following:
Code:
package a.pkg;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
public class ScanTests {
@Test
public void test() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.scan("a.pkg");
ctx.refresh();
ctx.getBean(FooConfig.class);
ctx.getBean(FooBean.class);
}
}
@Configuration
class FooConfig {
@Bean FooBean fooBean() { return new FooBean(); }
}
class FooBean { }
This test passes. the scan() method above does recognize @Configuration classes, because the @Configuration annotation is meta-annotated with @Component. By default, any directly or indirectly @Component-annotated class is a candidate for component scanning.
Are you observing some behavior other than this?