I have a SpringBoot main/Application.java class
@SpringBootApplication
@ComponentScan(value = "com.nfl.dm.shield", excludeFilters =
{
@ComponentScan.Filter(value = MemoryRepository.class, type = FilterType.ASSIGNABLE_TYPE)
}
)
public class Application {
final static Logger LOG = LoggerFactory.getLogger(Application.class);
public static void main(String[] args) {
LOG.info("Booting application...");
SpringApplication.run(Application.class, args);
}
}
and a similar one for Test
@Configuration
@ComponentScan(basePackages = {"com.nfl.dm.shield"}, excludeFilters =
{
@ComponentScan.Filter(value = MySqlRepository.class, type = FilterType.ASSIGNABLE_TYPE)
}
)
public class ApplicationTestConfig {
}
The main code runs correctly. The test code throws NoUniqueBeanDefinitionException, appearing to not properly filter out the unwanted MySqlRepository component.
Aucun commentaire:
Enregistrer un commentaire