Exception 自Spring 3.1.3以来没有此类定义异常
今天我在应用程序中使用了Spring版本。我从Spring3.1.1开始,当我转到Spring3.1.3时,我的应用程序开始在启动期间抛出NoSuchBeanDefinitionException org.springframework.beans.factory.noSuchBean定义异常:否 类型的匹配bean 找到的[nl.my.product.properties.properties] 依赖项:至少需要1个符合autowire条件的bean 此依赖项的候选项。依赖项批注:{} 我在应用程序上下文中配置了Properties bean,如下所示:Exception 自Spring 3.1.3以来没有此类定义异常,exception,javabeans,spring-3,autowired,Exception,Javabeans,Spring 3,Autowired,今天我在应用程序中使用了Spring版本。我从Spring3.1.1开始,当我转到Spring3.1.3时,我的应用程序开始在启动期间抛出NoSuchBeanDefinitionException org.springframework.beans.factory.noSuchBean定义异常:否 类型的匹配bean 找到的[nl.my.product.properties.properties] 依赖项:至少需要1个符合autowire条件的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>
@Autowired
public ArticleController(ArticleService articleService, PageBlockService pageBlockService, Properties systemProperties) {
this.articleService = articleService;
this.pageBlockService = pageBlockService;
this.properties = systemProperties;
}
关于为什么Spring在Spring3.1.3之后找不到我的bean,有什么线索吗?我尝试将Properties bean移动到一个包中,使其不被扫描组件,但这并不能解决问题
当我用@Component注释属性bean时,Spring会将其选中,但是属性映射是空的。当我从bean定义中删除
id=“systemProperties”
时,它开始工作