如何使用 @Configuration 排除 spring 配置文件以依赖于其他项目
How to exclude spring configuration files with @Configuration for dependency on other project
我有一个项目 A[In Maven],它依赖于项目 B[In Maven]。现在项目 B 有一些 spring @Configuration[db configuration ] 文件,这些文件在我构建和部署我的项目 A 时启动,但由于我的项目 A 中没有的一些配置属性,它显示了一些错误。那么如何在项目 B 中使用其他依赖项时排除项目 A 中的配置文件。
您可以在组件扫描中添加 excludeFilters 以跳过 class
@ComponentScan(value = {'your.package.here'}, excludeFilters = @Filter(ConfigurationToIgnore.class))
我有一个项目 A[In Maven],它依赖于项目 B[In Maven]。现在项目 B 有一些 spring @Configuration[db configuration ] 文件,这些文件在我构建和部署我的项目 A 时启动,但由于我的项目 A 中没有的一些配置属性,它显示了一些错误。那么如何在项目 B 中使用其他依赖项时排除项目 A 中的配置文件。
您可以在组件扫描中添加 excludeFilters 以跳过 class
@ComponentScan(value = {'your.package.here'}, excludeFilters = @Filter(ConfigurationToIgnore.class))