{"id":"675bece8560b9d06","repo":"spring-projects/spring-framework","slug":"only-supports-includenonsingletons-true-by-default","errorCode":null,"errorMessage":"Only supports includeNonSingletons=true by default","messagePattern":"Only supports includeNonSingletons=true by default","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spring-beans/src/main/java/org/springframework/beans/factory/ObjectProvider.java","lineNumber":307,"sourceCode":"\tdefault Stream<T> orderedStream(Predicate<Class<?>> customFilter) {\n\t\treturn orderedStream(customFilter, true);\n\t}\n\n\t/**\n\t * Return a custom-filtered {@link Stream} over all matching object instances,\n\t * without specific ordering guarantees (but typically in registration order).\n\t * @param customFilter a custom type filter for selecting beans among the raw\n\t * bean type matches (or {@link #UNFILTERED} for all raw type matches without\n\t * any default filtering)\n\t * @param includeNonSingletons whether to include prototype or scoped beans too\n\t * or just singletons (also applies to FactoryBeans)\n\t * @since 6.2.5\n\t * @see #stream(Predicate)\n\t * @see #orderedStream(Predicate, boolean)\n\t */\n\tdefault Stream<T> stream(Predicate<Class<?>> customFilter, boolean includeNonSingletons) {\n\t\tif (!includeNonSingletons) {\n\t\t\tthrow new UnsupportedOperationException(\"Only supports includeNonSingletons=true by default\");\n\t\t}\n\t\treturn stream().filter(obj -> customFilter.test(obj.getClass()));\n\t}\n\n\t/**\n\t * Return a custom-filtered {@link Stream} over all matching object instances,\n\t * pre-ordered according to the factory's common order comparator.\n\t * @param customFilter a custom type filter for selecting beans among the raw\n\t * bean type matches (or {@link #UNFILTERED} for all raw type matches without\n\t * any default filtering)\n\t * @param includeNonSingletons whether to include prototype or scoped beans too\n\t * or just singletons (also applies to FactoryBeans)\n\t * @since 6.2.5\n\t * @see #orderedStream()\n\t * @see #stream(Predicate)\n\t */\n\tdefault Stream<T> orderedStream(Predicate<Class<?>> customFilter, boolean includeNonSingletons) {\n\t\tif (!includeNonSingletons) {","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/e8729d043887bf0d0baf91e062e909b56eb2b708/spring-beans/src/main/java/org/springframework/beans/factory/ObjectProvider.java#L289-L325","documentation":"Error \"Only supports includeNonSingletons=true by default\" thrown in spring-projects/spring-framework.","triggerScenarios":"Thrown at spring-beans/src/main/java/org/springframework/beans/factory/ObjectProvider.java:307 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e8729d043887bf0d0baf91e062e909b56eb2b708","analyzedAt":"2026-08-04T19:07:39.725Z","schemaVersion":2}