Refine GenericApplicationContext#registerBean nullness

Closes gh-34343
This commit is contained in:
Sébastien Deleuze
2025-01-30 12:26:31 +01:00
parent 042b78f609
commit 4620d864dd

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
@@ -491,7 +491,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
* (may be {@code null} or empty)
* @since 5.2 (since 5.0 on the AnnotationConfigApplicationContext subclass)
*/
public <T> void registerBean(Class<T> beanClass, Object... constructorArgs) {
public <T> void registerBean(Class<T> beanClass, @Nullable Object... constructorArgs) {
registerBean(null, beanClass, constructorArgs);
}
@@ -506,7 +506,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
* (may be {@code null} or empty)
* @since 5.2 (since 5.0 on the AnnotationConfigApplicationContext subclass)
*/
public <T> void registerBean(@Nullable String beanName, Class<T> beanClass, Object... constructorArgs) {
public <T> void registerBean(@Nullable String beanName, Class<T> beanClass, @Nullable Object... constructorArgs) {
registerBean(beanName, beanClass, (Supplier<T>) null,
bd -> {
for (Object arg : constructorArgs) {