Can @Configuration work without @componentScan (Spring JavaConfig @annotaion)
<p>--Appconfig.java </p>

<pre><code>@Configuration
public class AppConfig {    

  @Bean(name="helloBean")
  public HelloWorld helloWorld() {
    return new HelloWorldImpl();
   }
}
</code></pre>

<p>--interface.java</p>

<pre><code>public interface HelloWorld {
    void printHelloWorld(String msg);
} 
</code></pre>

<p>--ipml.java</p>

<pre><code>public class HelloWorldImpl implements HelloWorld {
public void printHelloWorld(String msg) {
    System.out.println("Hello! : " + msg);
   --
}
</code></pre>

<p>--App.java </p>

<pre><code>public class App {

public static void main(String[] args) {

    AnnotationConfigApplicationContext context = new 
    new AnnotationConfigApplicationContext(AppConfig.class);

HelloWorld obj = (HelloWorld) context.getBean(HelloWorldImpl.class);

obj.printHelloWorld("Spring3 Java Config");
   }
}
</code></pre>

<p>My program can works, but my question is why I don't need to add <code>@componentScan</code> in Appconfig.java .</p>

<p>It seems to <code>@Configuration</code> and <code>@Bean</code> can be found by Spring whithout using <code>@componentScan</code>.</p>

<p>I thought if you want to use @annotation ,you must use @componentScan or </p>

<p><code>context:component-scan(xml)</code>, 
am I right?</p>