我们的应用程序需要支持多租户.每个登机客户都可能会覆盖一个或多个bean或核心平台级别定义的bean的某些属性(公共代码/定义).我想知道处理这个问题的最佳方法是什么.
我有一个configuartion课程
@Configuration
public class FooConfig{
@Bean
public FooService fooService() { ... }
@Bean
public AbcService abcService() { ... }
}
Run Code Online (Sandbox Code Playgroud)
该类在lib中定义,我无法更改.我有一个项目,FooService在很多地方使用.在我的项目中,我有另一个配置类
@Configuration
@Import({
FooConfig.class,
})
public class BarConfig{
@Autowired AbcService abc;
...
}
Run Code Online (Sandbox Code Playgroud)
AbcService这里使用的是因为有些服务依赖于该服务并且声明了服务BarConfig.但是,FooService此处未使用(仅在控制器中使用)
我需要改变执行FooService.我可以定义新的FooServicebean BarConfig吗?它是否会覆盖通过导入的已存在的定义FooConfig?