Skip to content

Commit

Permalink
Merge pull request #29753 from perlun
Browse files Browse the repository at this point in the history
* pr/29753:
  Polish "Make sure NoUniqueBeanDefinitionException to be serializable"
  Make sure NoUniqueBeanDefinitionException to be serializable

Closes gh-29753
  • Loading branch information
snicoll committed Aug 27, 2023
2 parents ca14202 + 1396daa commit 1af259f
Showing 1 changed file with 4 additions and 3 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,7 @@

package org.springframework.beans.factory;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

Expand Down Expand Up @@ -61,7 +62,7 @@ public NoUniqueBeanDefinitionException(Class<?> type, Collection<String> beanNam
super(type, "expected single matching bean but found " + beanNamesFound.size() + ": " +
StringUtils.collectionToCommaDelimitedString(beanNamesFound));
this.numberOfBeansFound = beanNamesFound.size();
this.beanNamesFound = beanNamesFound;
this.beanNamesFound = new ArrayList<>(beanNamesFound);
}

/**
Expand All @@ -83,7 +84,7 @@ public NoUniqueBeanDefinitionException(ResolvableType type, Collection<String> b
super(type, "expected single matching bean but found " + beanNamesFound.size() + ": " +
StringUtils.collectionToCommaDelimitedString(beanNamesFound));
this.numberOfBeansFound = beanNamesFound.size();
this.beanNamesFound = beanNamesFound;
this.beanNamesFound = new ArrayList<>(beanNamesFound);
}

/**
Expand Down

0 comments on commit 1af259f

Please sign in to comment.