{"record":{"id":"d6f0d38272284894","repo":"flowable/flowable-engine","slug":"cannot-set-value-of-it-resolves-to-a-bean-defi","errorCode":null,"errorMessage":"Cannot set value of '', it resolves to a bean defined in the Spring application-context.","messagePattern":"Cannot set value of '', it resolves to a bean defined in the Spring application-context\\.","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-spring/src/main/java/org/activiti/spring/ApplicationContextElResolver.java","lineNumber":58,"sourceCode":"                context.setPropertyResolved(true);\n                return applicationContext.getBean(key);\n            }\n        }\n\n        return null;\n    }\n\n    @Override\n    public boolean isReadOnly(ELContext context, Object base, Object property) {\n        return true;\n    }\n\n    @Override\n    public void setValue(ELContext context, Object base, Object property, Object value) {\n        if (base == null) {\n            String key = (String) property;\n            if (applicationContext.containsBean(key)) {\n                throw new ActivitiException(\"Cannot set value of '\" + property + \"', it resolves to a bean defined in the Spring application-context.\");\n            }\n        }\n    }\n\n    @Override\n    public Class<?> getCommonPropertyType(ELContext context, Object arg) {\n        return Object.class;\n    }\n\n    @Override\n    public Class<?> getType(ELContext context, Object arg1, Object arg2) {\n        return Object.class;\n    }\n}\n","sourceCodeStart":40,"sourceCodeEnd":73,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-spring/src/main/java/org/activiti/spring/ApplicationContextElResolver.java#L40-L73","documentation":"Thrown by ApplicationContextElResolver.setValue when an EL expression attempts to assign to a name that resolves to a Spring bean. Beans in the application context are read-only from process expressions; writing to them is blocked to protect shared application state.","triggerScenarios":"An expression like ${myBean = something} or a task/form field assignment targeting a name that matches a Spring bean id in the process expressions.","commonSituations":"Typos in process variables that coincide with bean names; intentionally trying to mutate a bean from a script/expression; copying variable names from bean names.","solutions":["Rename the process variable so it does not collide with a bean name.","Assign to a process variable via runtimeService.setVariable instead of EL assignment.","If the value must be changed, delegate to a service task/JavaDelegate rather than assigning to the bean.","Catch ActivitiException if the assignment is user-supplied input and reject it with a clear message."],"exampleFix":"// before\n<flowable:expression>${orderService = newValue}</flowable:expression> // orderService is a bean\n// after\n<flowable:expression>${execution.setVariable('order', newValue)}</flowable:expression>","handlingStrategy":"validation","validationCode":"String candidate = \"order\"; // name used in EL assignment\nif (applicationContext.containsBean(candidate)) throw new IllegalArgumentException(\"'\" + candidate + \"' collides with a Spring bean name; rename the variable\");","typeGuard":null,"tryCatchPattern":"try { delegateExpressionInvocation(); } catch (ActivitiException e) { log.error(\"Attempted to overwrite a Spring bean from EL: {}\", e.getMessage()); }","preventionTips":["Name process variables distinctly from Spring bean ids","Never assign to bean names in EL expressions","Use service tasks/delegates to mutate application state"],"tags":["spring","el","read-only"],"backgroundTag":"permission-denied","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}