diff --git a/spring-grpc-core/src/main/java/org/springframework/grpc/server/service/ApplicationContextBeanLookupUtils.java b/spring-grpc-core/src/main/java/org/springframework/grpc/internal/ApplicationContextBeanLookupUtils.java similarity index 90% rename from spring-grpc-core/src/main/java/org/springframework/grpc/server/service/ApplicationContextBeanLookupUtils.java rename to spring-grpc-core/src/main/java/org/springframework/grpc/internal/ApplicationContextBeanLookupUtils.java index f33625d..5eaad6c 100644 --- a/spring-grpc-core/src/main/java/org/springframework/grpc/server/service/ApplicationContextBeanLookupUtils.java +++ b/spring-grpc-core/src/main/java/org/springframework/grpc/internal/ApplicationContextBeanLookupUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.grpc.server.service; +package org.springframework.grpc.internal; import java.lang.annotation.Annotation; import java.util.LinkedHashMap; @@ -29,10 +29,13 @@ import org.springframework.util.Assert; /** * Convenience methods performing bean lookups that are not currently provided by the * standard Spring facilities. + *

+ * NOTE: This is considered an internal non-public API despite its public method + * accessors. * * @author Chris Bono */ -final class ApplicationContextBeanLookupUtils { +public final class ApplicationContextBeanLookupUtils { private ApplicationContextBeanLookupUtils() { } @@ -56,7 +59,7 @@ final class ApplicationContextBeanLookupUtils { * @return a map of matching bean instances with the annotation instance (or null) * ordered according to their {@link Order} with annotation */ - static LinkedHashMap getOrderedBeansWithAnnotation( + public static LinkedHashMap getOrderedBeansWithAnnotation( ApplicationContext applicationContext, Class beanType, Class annotationType) { Assert.notNull(applicationContext, () -> "applicationContext must not be null"); var annotatedBeanNamesToBeans = applicationContext.getBeansWithAnnotation(annotationType); @@ -87,7 +90,7 @@ final class ApplicationContextBeanLookupUtils { * @return a list of the matching beans ordered according to their {@link Order} * annotation */ - static List getBeansWithAnnotation(ApplicationContext applicationContext, + public static List getBeansWithAnnotation(ApplicationContext applicationContext, Class beanType, Class annotationType) { Assert.notNull(applicationContext, () -> "applicationContext must not be null"); var nameToBeanMap = applicationContext.getBeansWithAnnotation(annotationType); @@ -104,7 +107,7 @@ final class ApplicationContextBeanLookupUtils { * @param beanType the type of beans in the list * @param beans the list of beans to sort */ - static void sortBeansIncludingOrderAnnotation(ApplicationContext applicationContext, Class beanType, + public static void sortBeansIncludingOrderAnnotation(ApplicationContext applicationContext, Class beanType, List beans) { var beanToNameMap = new LinkedHashMap(); applicationContext.getBeansOfType(beanType).forEach((name, bean) -> beanToNameMap.put(bean, name)); diff --git a/spring-grpc-core/src/main/java/org/springframework/grpc/server/service/DefaultGrpcServiceConfigurer.java b/spring-grpc-core/src/main/java/org/springframework/grpc/server/service/DefaultGrpcServiceConfigurer.java index ed75e49..3a54e80 100644 --- a/spring-grpc-core/src/main/java/org/springframework/grpc/server/service/DefaultGrpcServiceConfigurer.java +++ b/spring-grpc-core/src/main/java/org/springframework/grpc/server/service/DefaultGrpcServiceConfigurer.java @@ -21,6 +21,7 @@ import java.util.List; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ApplicationContext; +import org.springframework.grpc.internal.ApplicationContextBeanLookupUtils; import org.springframework.grpc.server.GlobalServerInterceptor; import org.springframework.lang.Nullable; diff --git a/spring-grpc-core/src/main/java/org/springframework/grpc/server/service/DefaultGrpcServiceDiscoverer.java b/spring-grpc-core/src/main/java/org/springframework/grpc/server/service/DefaultGrpcServiceDiscoverer.java index 089d1df..494efd0 100644 --- a/spring-grpc-core/src/main/java/org/springframework/grpc/server/service/DefaultGrpcServiceDiscoverer.java +++ b/spring-grpc-core/src/main/java/org/springframework/grpc/server/service/DefaultGrpcServiceDiscoverer.java @@ -19,6 +19,7 @@ package org.springframework.grpc.server.service; import java.util.List; import org.springframework.context.ApplicationContext; +import org.springframework.grpc.internal.ApplicationContextBeanLookupUtils; import org.springframework.lang.Nullable; import io.grpc.BindableService;