2016년 7월 10일 일요일

@ComponentScan

1. @Component 어노테이션이 적용된 클래스를 검색하여 빈으로 등록합니다.
2. XML이나 Annotation 두 가지 방법 중 하나를 선택할 수 있습니다.
   XML : <context:component-scan>
   Annotation : @ComponentScan
3. base 패키지를 지정할 수 있습니다. 


//=================================원문=================================//
org.springframework.context.annotation

Annotation Type ComponentScan

@EnableAutoConfiguration

1.  원하는 class에 Spring Application Context를 auto-configuration 합니다. 
    (사용자가 원하는 bean을 추측하여 configure)

2. configure 되길 원하지 않는 클래스를  manually exclude 할 수 있습니다.

3. @EnableAutoConfiguration를 사용한 클래스의 패키지는 sub-package에 있는 
 @Entity 클래스들을 scan합니다. (따라서 root package의 classdㅔ서 사용하길 권장)

//===================================원문===================================//
org.springframework.boot.autoconfigure

Annotation Type EnableAutoConfiguration

"Java 8의 lambda"만 계속 에러를 낼 경우

다음과 같은 에러 메세지를 보여줍니다.
    Method references are allowed only at source level 1.8 or above


이럴 경우 프로젝트의 properties -> Java compiler -> compliance level 을 1.8로 맞춰주면 됩니다.