我有一个子模块,我们称它为A,它也充当库,并且其中包含一些rest控制器。我已经将该模块作为依赖项导入到另一个项目(例如B)中。当我启动SpringBoot项目B时,模块A的API也从外部公开并可以访问。 我曾尝试使用排除过滤器,但仍然公开了底层模块API。
@SpringBootApplication
@ComponentScan(basePackages = {"com.ad2pro.spectra"},
excludeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = "com.ad2pro.spectra.corp.metadata.controller.*")) // tried this exclude filter, but not working
@EnableJpaRepositories("com.ad2pro.spectra.core.acs.repositories")
@Import({CorpMetaServiceApp.class}) // This is the module which am importing and has rest APIs in it
public class ApplicationDriver {
public static void main(String[] args) {
SpringApplication.run(ApplicationDriver.class, args);
}
}
还有其他方法可以限制对属于我的依赖项的API的访问吗?