如果自己配置组件,你可以使用子类设置必要的依赖,例如,如果你正使用Hibernate搜索,并将Elasticsearch作为它的索引管理器,这样任何 beans必须设置为依赖 bean: