{"record":{"id":"340737d977256794","repo":"flowable/flowable-engine","slug":"can-t-search-values-in-configuration-beans","errorCode":null,"errorMessage":"can't search values in configuration beans","messagePattern":"can't search values in configuration beans","errorType":"exception","errorClass":"org.flowable.common.engine.api.FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/cfg/SpringBeanFactoryProxyMap.java","lineNumber":65,"sourceCode":"        return beanFactory.containsBean((String) key);\n    }\n\n    @Override\n    public Set<Object> keySet() {\n        throw new FlowableException(\"unsupported operation on configuration beans\");\n        // List<String> beanNames =\n        // Arrays.asList(beanFactory.getBeanDefinitionNames());\n        // return new HashSet<Object>(beanNames);\n    }\n\n    @Override\n    public void clear() {\n        throw new FlowableException(\"can't clear configuration beans\");\n    }\n\n    @Override\n    public boolean containsValue(Object value) {\n        throw new FlowableException(\"can't search values in configuration beans\");\n    }\n\n    @Override\n    public Set<Map.Entry<Object, Object>> entrySet() {\n        throw new FlowableException(\"unsupported operation on configuration beans\");\n    }\n\n    @Override\n    public boolean isEmpty() {\n        throw new FlowableException(\"unsupported operation on configuration beans\");\n    }\n\n    @Override\n    public Object put(Object key, Object value) {\n        throw new FlowableException(\"unsupported operation on configuration beans\");\n    }\n\n    @Override","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/cfg/SpringBeanFactoryProxyMap.java#L47-L83","documentation":"containsValue(Object) is unsupported: SpringBeanFactoryProxyMap only resolves beans by name key; reverse lookup of a value would require instantiating/inspecting every bean, so it throws unconditionally.","triggerScenarios":"Calling containsValue(value) directly, or indirectly through AbstractMap helpers, Map constructors that validate contents, or framework code performing reverse-lookup checks on the map.","commonSituations":"Checking whether a bean instance is already present in configuration before registering a replacement, or generic Map-equality/diff utilities run over configuration maps.","solutions":["Avoid value-based checks; resolve beans by name with get()/containsKey() instead","Compare bean instances from beanFactory.getBean(...) with equals() on your known candidates","Track beans you resolve in your own Map/Collection if you need membership checks on values"],"exampleFix":"// before\nboolean has = configBeans.containsValue(myBean);\n// after\nboolean has = configBeans.containsValue(myBean) == false && knownBeans.containsValue(myBean);\n// or: track resolved beans yourself\nMap<Object,Object> resolved = new HashMap<>();\nObject b = configBeans.get(\"myBean\");\nif (b != null) resolved.put(\"myBean\", b);\nboolean has = resolved.containsValue(myBean);","handlingStrategy":"type-guard","validationCode":"if (map instanceof SpringBeanFactoryProxyMap) {\n    // do reverse lookup via beanFactory.getBean(...) on known candidates instead\n}","typeGuard":"boolean supportsContainsValue(Map<?,?> m) { return !(m instanceof SpringBeanFactoryProxyMap); }","tryCatchPattern":"try {\n    found = map.containsValue(bean);\n} catch (FlowableException e) {\n    found = myResolvedBeans.containsValue(bean);\n}","preventionTips":["Resolve beans by name; never reverse-lookup by value","Track beans you resolve in your own collection for membership checks"],"tags":["spring","map","unsupported-operation","flowable"],"backgroundTag":"unsupported-operation","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}