更新时间:2023-10-09 18:11:52
我认为您应该使用 @Profile, UserDetailesService
是一个接口,用于创建 UserDetailesService
的两个实现,一个用于测试,另一个用于其余的情况
I think you should use @Profile, UserDetailesService
is an interface creates two implementation of UserDetailesService
, one for test and another for the rest of the case
@Component
@Profile("test")
public class UserDetailesServiceTestImpl implements UserDetailesService{
}
@Component
@Profile("!test")
public class UserDetailesServiceImpl implements UserDetailesService{
}