Avoid rescanning names for cached function lookups - #1525
Closed
2748109647 wants to merge 1 commit into
Closed
2748109647 wants to merge 1 commit into
2748109647 wants to merge 1 commit into
Conversation
Contributor
|
Thanks for the contribution, the change looks good. Could you please sign off your commit under the Developer Certificate of Origin? You can do that with: so that the commit message ends with a |
Signed-off-by: Alpha <2748109647@qq.com>
2748109647
force-pushed
the
codex/issue-1518-cache-known-function-definitions
branch
from
November 22, 2026 09:13
07b27eb to
b97ac17
Compare
olegz
added a commit
that referenced
this pull request
Nov 22, 2026
… lookups Use String.replace(char, char) instead of a regex based replaceAll when normalizing function definitions, and add a SimpleFunctionRegistry level test verifying that looking up an already resolved definition, in its comma or pipe form, does not enumerate the function names again. Resolves #1525 Signed-off-by: Oleg Zhurakousky <oleg.zhurakousky@broadcom.com>
olegz
added a commit
that referenced
this pull request
Nov 22, 2026
… function names normalizeFunctionDefinition() replaces the requested definition with the only eligible function when single function fallback is enabled, but only if the definition is not one of the known function names. The shortcut for definitions that are already cached or registered does not cover names that exist as beans and are not registered yet, such as functionRouter, so the lookup of functionRouter was turned into a lookup of the only other function and HTTP requests to it were rejected by the method allow-list. Check the known names again before applying the fallback and add a test. Resolves #1525 Signed-off-by: Oleg Zhurakousky <oleg.zhurakousky@broadcom.com>
zemiles
pushed a commit
to zemiles/spring-cloud-function
that referenced
this pull request
Nov 24, 2026
… test cached lookups Use String.replace(char, char) instead of a regex based replaceAll when normalizing function definitions, and add a SimpleFunctionRegistry level test verifying that looking up an already resolved definition, in its comma or pipe form, does not enumerate the function names again. Resolves spring-cloud#1525 Signed-off-by: Oleg Zhurakousky <oleg.zhurakousky@broadcom.com>
zemiles
pushed a commit
to zemiles/spring-cloud-function
that referenced
this pull request
Nov 24, 2026
…ack to known function names normalizeFunctionDefinition() replaces the requested definition with the only eligible function when single function fallback is enabled, but only if the definition is not one of the known function names. The shortcut for definitions that are already cached or registered does not cover names that exist as beans and are not registered yet, such as functionRouter, so the lookup of functionRouter was turned into a lookup of the only other function and HTTP requests to it were rejected by the method allow-list. Check the known names again before applying the fallback and add a test. Resolves spring-cloud#1525 Signed-off-by: Oleg Zhurakousky <oleg.zhurakousky@broadcom.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1518
Message-level routing calls
FunctionCatalog.lookupfor every message. Before checking the wrapped-function cache,SimpleFunctionRegistry.normalizeFunctionDefinitionenumerated function names; with the Spring-aware registry, this triggers repeatedgetBeanNamesForTypescans.The lookup now checks the synchronized wrapper cache and already registered function names before enumerating the full catalog. Unknown definitions still use the existing name-enumeration and single-function fallback path. No public API changes.
A regression test routes the same message twice and verifies the second lookup does not call
getNames(null).Validation:
.\mvnw.cmd -pl spring-cloud-function-context "-Dtest=BeanFactoryAwareFunctionRegistryTests,SimpleFunctionRegistryTests" -DfailIfNoTests=false test— BUILD SUCCESS; 89 tests, 0 failures, 0 errors, 3 skipped (Java 21).git diff --check— passed.