Use constructor rather than Collection.addAll

See gh-41053
This commit is contained in:
Piyal Ahmed
2024-06-11 16:18:49 +06:00
committed by Phillip Webb
parent d37098153c
commit 17adcfc180
5 changed files with 5 additions and 10 deletions

View File

@@ -68,8 +68,7 @@ class ServiceConnectionAutoConfigurationRegistrar implements ImportBeanDefinitio
private Set<ServiceConnection> getAnnotations(ConfigurableListableBeanFactory beanFactory, String beanName,
BeanDefinition beanDefinition) {
Set<ServiceConnection> annotations = new LinkedHashSet<>();
annotations.addAll(beanFactory.findAllAnnotationsOnBean(beanName, ServiceConnection.class, false));
Set<ServiceConnection> annotations = new LinkedHashSet<>(beanFactory.findAllAnnotationsOnBean(beanName, ServiceConnection.class, false));
if (beanDefinition instanceof TestcontainerBeanDefinition testcontainerBeanDefinition) {
testcontainerBeanDefinition.getAnnotations()
.stream(ServiceConnection.class)