Polish Bean Override internals and tests

This commit is contained in:
Sam Brannen
2025-01-14 11:25:37 +01:00
parent 799566573a
commit ff9b7678a7
10 changed files with 107 additions and 67 deletions

View File

@@ -243,6 +243,8 @@ public abstract class BeanOverrideHandler {
!Objects.equals(this.strategy, that.strategy)) {
return false;
}
// by-name lookup
if (this.beanName != null) {
return true;
}

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.
@@ -109,8 +109,7 @@ class BeanOverrideRegistry {
void inject(Object target, BeanOverrideHandler handler) {
String beanName = this.handlerToBeanNameMap.get(handler);
Assert.state(StringUtils.hasLength(beanName),
() -> "No bean found for BeanOverrideHandler: " + handler);
Assert.state(StringUtils.hasLength(beanName), () -> "No bean found for BeanOverrideHandler: " + handler);
inject(handler.getField(), target, beanName);
}

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.