2013-11-27 2 views
0

오늘 내 응용 프로그램에서 Spring 버전으로 놀았습니다. 스프링 3.1.1부터 시작했는데 스프링 3.1.3으로 옮겼을 때 애플리케이션이 시작하는 동안 NoSuchBeanDefinitionException을 던지기 시작했다.NoSuchBeanDefinitionException Spring 3.1.3 이후

org.springframework.beans.factory.NoSuchBeanDefinitionException : 자동으로 묶어 후보로서 자격이 예상 적어도 1 빈 : 종속성 검색 결과 형 [nl.my.product.properties.Properties] 없음 정합 콩 이 의존성에 대해. 종속성 주석 : {}

는이 같은 애플리케이션 컨텍스트에 등록 bean을 구성 :

<!-- Gather properties from environment.properties in a map --> 
<bean id="systemProperties" class="nl.my.product.properties.Properties"> 
    <property name="propertyMap"> 
     <map> 
      <entry key="email.from.address" value="${email.from.address}"/> 
      <entry key="site.host" value="${site.host}"/> 
      <entry key="site.protocol" value="${site.protocol}"/> 
      ... 
     </map> 
    </property> 
</bean> 

그리고 나는이 같은 내 컨트롤러와 많은 서비스에 콩을 autowire가 :

@Autowired 
public ArticleController(ArticleService articleService, PageBlockService pageBlockService, Properties systemProperties) { 
    this.articleService = articleService; 
    this.pageBlockService = pageBlockService; 
    this.properties = systemProperties; 
} 

Spring 3.1.3 이후 Spring이 나의 bean을 찾을 수없는 이유에 대한 단서가 있습니까? Properties 빈을 패키지로 이동하여 구성 요소를 검사하지 않았지만 문제가 해결되지 않았습니다.

@Component로 Properties 빈에 주석을 달았을 때 Spring은 그것을 가져 오지만 속성 맵은 비어 있습니다.

답변

0

빈 정의에서 id="systemProperties"을 제거했을 때 작동을 시작했습니다.

관련 문제