This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 82e73a24ed Clean up juneau-rest-server
82e73a24ed is described below

commit 82e73a24ed61f8f572cdd6a3cd043a9288d31278
Author: James Bognar <[email protected]>
AuthorDate: Mon Jan 5 12:15:50 2026 -0500

    Clean up juneau-rest-server
---
 .../java/org/apache/juneau/cp/BasicBeanStore.java  | 40 +----------
 .../apache/juneau/cp/BeanCreateMethodFinder.java   | 13 ++--
 .../java/org/apache/juneau/rest/RestContext.java   | 67 +++++++++--------
 .../java/org/apache/juneau/rest/RestOpContext.java | 83 ++++++++--------------
 .../java/org/apache/juneau/cp/BeanStore_Test.java  |  6 +-
 5 files changed, 72 insertions(+), 137 deletions(-)

diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
index eb7ca0c469..1dae0428d4 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
@@ -70,9 +70,8 @@ import org.apache.juneau.commons.reflect.*;
  * Beans are created through the following methods:
  * <ul class='javatreec'>
  *     <li class='jm'>{@link BeanCreator#of(Class,BasicBeanStore) 
BeanCreator.of(Class,BasicBeanStore)}
- *     <li class='jm'>{@link #createMethodFinder(Class) 
createMethodFinder(Class)}
- *     <li class='jm'>{@link #createMethodFinder(Class,Class) 
createMethodFinder(Class,Class)}
- *     <li class='jm'>{@link #createMethodFinder(Class,Object) 
createMethodFinder(Class,Object)}
+ *     <li class='jc'>{@link 
BeanCreateMethodFinder#BeanCreateMethodFinder(Class,Class,BasicBeanStore) 
BeanCreateMethodFinder(Class,Class,BasicBeanStore)}
+ *     <li class='jc'>{@link 
BeanCreateMethodFinder#BeanCreateMethodFinder(Class,Object,BasicBeanStore) 
BeanCreateMethodFinder(Class,Object,BasicBeanStore)}
  * </ul>
  *
  * <h5 class='section'>Notes:</h5><ul>
@@ -392,41 +391,6 @@ public class BasicBeanStore {
         * </ul>
         *
 
-       /**
-        * Create a method finder for finding bean creation methods.
-        *
-        * <p>
-        * Same as {@link #createMethodFinder(Class,Class)} but looks for only 
static methods on the specified resource class
-        * and not also instance methods within the context of a bean.
-        *
-        * <h5 class='section'>See Also:</h5><ul>
-        *      <li class='jc'>{@link BeanCreateMethodFinder} for usage.
-        * </ul>
-        *
-        * @param <T> The bean type to create.
-        * @param beanType The bean type to create.
-        * @param resourceClass The class containing the bean creator method.
-        * @return The method finder.  Never <jk>null</jk>.
-        */
-       public <T> BeanCreateMethodFinder<T> createMethodFinder(Class<T> 
beanType, Class<?> resourceClass) {
-               return new BeanCreateMethodFinder<>(beanType, resourceClass, 
this);
-       }
-
-       /**
-        * Create a method finder for finding bean creation methods.
-        *
-        * <h5 class='section'>See Also:</h5><ul>
-        *      <li class='jc'>{@link BeanCreateMethodFinder} for usage.
-        * </ul>
-        *
-        * @param <T> The bean type to create.
-        * @param beanType The bean type to create.
-        * @param resource The class containing the bean creator method.
-        * @return The method finder.  Never <jk>null</jk>.
-        */
-       public <T> BeanCreateMethodFinder<T> createMethodFinder(Class<T> 
beanType, Object resource) {
-               return new BeanCreateMethodFinder<>(beanType, resource, this);
-       }
 
        /**
         * Returns the unnamed bean of the specified type.
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreateMethodFinder.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreateMethodFinder.java
index 67a0c0fee8..5b9ea84f20 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreateMethodFinder.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreateMethodFinder.java
@@ -37,9 +37,8 @@ import org.apache.juneau.commons.reflect.*;
  * <ul class='javatree'>
  *     <li class='jc'>{@link BasicBeanStore}
  *             <ul class='javatreec'>
- *                     <li class='jm'>{@link 
BasicBeanStore#createMethodFinder(Class)}
- *                     <li class='jm'>{@link 
BasicBeanStore#createMethodFinder(Class,Class)}
- *                     <li class='jm'>{@link 
BasicBeanStore#createMethodFinder(Class,Object)}
+ *                     <li class='jc'>{@link 
BeanCreateMethodFinder#BeanCreateMethodFinder(Class,Class,BasicBeanStore) 
BeanCreateMethodFinder(Class,Class,BasicBeanStore)}
+ *                     <li class='jc'>{@link 
BeanCreateMethodFinder#BeanCreateMethodFinder(Class,Object,BasicBeanStore) 
BeanCreateMethodFinder(Class,Object,BasicBeanStore)}
  *             </ul>
  *     </li>
  * </ul>
@@ -67,7 +66,7 @@ import org.apache.juneau.commons.reflect.*;
  *
  *     <jc>// Instantiate the bean using the creator method.</jc>
  *     A <mv>a</mv> = <mv>beanStore</mv>
- *             .createMethodFinder(A.<jk>class</jk>, <mv>b</mv>)  <jc>// 
Looking for creator for A on b object.</jc>
+ *             <ja>// new BeanCreateMethodFinder(A.class, b, beanStore)</ja>  
<jc>// Looking for creator for A on b object.</jc>
  *             .find(<js>"createA"</js>)                         <jc>// Look 
for method called "createA".</jc>
  *             .thenFind(<js>"createA2"</js>)                    <jc>// Then 
look for method called "createA2".</jc>
  *             .withDefault(()-&gt;<jk>new</jk> A())                        
<jc>// Optionally supply a default value if method not found.</jc>
@@ -90,14 +89,14 @@ public class BeanCreateMethodFinder<T> {
        private MethodInfo method;
        private Object[] args;
 
-       BeanCreateMethodFinder(Class<T> beanType, Class<?> resourceClass, 
BasicBeanStore beanStore) {
+       public BeanCreateMethodFinder(Class<T> beanType, Class<?> 
resourceClass, BasicBeanStore beanStore) {
                this.beanType = assertArgNotNull("beanType", beanType);
                this.resource = null;
                this.resourceClass = assertArgNotNull("resourceClass", 
resourceClass);
                this.beanStore = BasicBeanStore.of(beanStore);
        }
 
-       BeanCreateMethodFinder(Class<T> beanType, Object resource, 
BasicBeanStore beanStore) {
+       public BeanCreateMethodFinder(Class<T> beanType, Object resource, 
BasicBeanStore beanStore) {
                this.beanType = assertArgNotNull("beanType", beanType);
                this.resource = assertArgNotNull("resource", resource);
                this.resourceClass = resource.getClass();
@@ -136,7 +135,7 @@ public class BeanCreateMethodFinder<T> {
         * This method can be called multiple times with different method names 
or required parameters until a match is found.
         * <br>Once a method is found, subsequent calls to this method will be 
no-ops.
         *
-        * See {@link BasicBeanStore#createMethodFinder(Class, Object)} for 
usage.
+        * See {@link 
BeanCreateMethodFinder#BeanCreateMethodFinder(Class,Object,BasicBeanStore)} for 
usage.
         *
         * @param filter The predicate to apply.
         * @return This object.
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
index 27d19aa7eb..cdf5143832 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
@@ -1806,8 +1806,7 @@ public class RestContext extends Context {
                                var name = 
RestInjectAnnotation.name(x.getAnnotations(RestInject.class).findFirst().map(AnnotationInfo::inner).orElse(null));
                                if (! (DELAYED_INJECTION.contains(rt) || 
DELAYED_INJECTION_NAMES.contains(name))) {
                                        // @formatter:off
-                                       beanStore
-                                               .createMethodFinder(rt, 
resource.get())
+                                       new BeanCreateMethodFinder<>(rt, 
resource.get(), beanStore)
                                                
.find(Builder::isRestInjectMethod)
                                                .run(y -> beanStore.add(rt, y, 
name));
                                        // @formatter:on
@@ -3877,8 +3876,8 @@ public class RestContext extends Context {
 
                        // Replace with bean from:  @RestInject public [static] 
BasicBeanStore xxx(<args>)
                        // @formatter:off
-                       v.get().build()
-                               .createMethodFinder(BasicBeanStore.class, 
resource.get())
+                       var bs = v.get().build();
+                       new BeanCreateMethodFinder<>(BasicBeanStore.class, 
resource.get(), bs)
                                .find(Builder::isRestInjectMethod)
                                .run(x -> v.get().impl(x));
                        // @formatter:on
@@ -3909,7 +3908,7 @@ public class RestContext extends Context {
                        beanStore.getBean(CallLogger.class).ifPresent(x -> 
creator.impl(x));
 
                        // Replace with bean from:  @RestInject public [static] 
CallLogger xxx(<args>)
-                       beanStore.createMethodFinder(CallLogger.class, 
resource.get()).find(Builder::isRestInjectMethod).run(x -> creator.impl(x));
+                       new BeanCreateMethodFinder<>(CallLogger.class, 
resource.get(), beanStore).find(Builder::isRestInjectMethod).run(x -> 
creator.impl(x));
 
                        return creator;
                }
@@ -3956,7 +3955,7 @@ public class RestContext extends Context {
                        beanStore.getBean(Config.class).ifPresent(x -> 
v.set(x));
 
                        // Replace with bean from:  @RestInject public [static] 
Config xxx(<args>)
-                       beanStore.createMethodFinder(Config.class, 
resource.get()).addBean(Config.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.set(x));
+                       new BeanCreateMethodFinder<>(Config.class, 
resource.get(), beanStore).addBean(Config.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.set(x));
 
                        return v.get();
                }
@@ -3980,7 +3979,7 @@ public class RestContext extends Context {
                        beanStore.getBean(DebugEnablement.class).ifPresent(x -> 
creator.impl(x));
 
                        // Replace with bean from:  @RestInject public [static] 
DebugEnablement xxx(<args>)
-                       beanStore.createMethodFinder(DebugEnablement.class, 
resource.get()).find(Builder::isRestInjectMethod).run(x -> creator.impl(x));
+                       new BeanCreateMethodFinder<>(DebugEnablement.class, 
resource.get(), beanStore).find(Builder::isRestInjectMethod).run(x -> 
creator.impl(x));
 
                        return creator;
                }
@@ -4002,7 +4001,7 @@ public class RestContext extends Context {
                        beanStore.getBean(NamedAttributeMap.class, 
"defaultRequestAttributes").ifPresent(x -> v.set(x));
 
                        // Replace with bean from:  
@RestInject(name="defaultRequestAttributes") public [static] NamedAttributeMap 
xxx(<args>)
-                       beanStore.createMethodFinder(NamedAttributeMap.class, 
resource.get()).addBean(NamedAttributeMap.class, v.get()).find(x -> 
isRestInjectMethod(x, "defaultRequestAttributes")).run(x -> v.set(x));
+                       new BeanCreateMethodFinder<>(NamedAttributeMap.class, 
resource.get(), beanStore).addBean(NamedAttributeMap.class, v.get()).find(x -> 
isRestInjectMethod(x, "defaultRequestAttributes")).run(x -> v.set(x));
 
                        return v.get();
                }
@@ -4025,7 +4024,7 @@ public class RestContext extends Context {
                        beanStore.getBean(HeaderList.class, 
"defaultRequestHeaders").ifPresent(x -> v.set(x));
 
                        // Replace with bean from:  
@RestInject(name="defaultRequestHeaders") public [static] HeaderList xxx(<args>)
-                       beanStore.createMethodFinder(HeaderList.class, 
resource.get()).addBean(HeaderList.class, v.get()).find(x -> 
isRestInjectMethod(x, "defaultRequestHeaders")).run(x -> v.set(x));
+                       new BeanCreateMethodFinder<>(HeaderList.class, 
resource.get(), beanStore).addBean(HeaderList.class, v.get()).find(x -> 
isRestInjectMethod(x, "defaultRequestHeaders")).run(x -> v.set(x));
 
                        return v.get();
                }
@@ -4048,7 +4047,7 @@ public class RestContext extends Context {
                        beanStore.getBean(HeaderList.class, 
"defaultResponseHeaders").ifPresent(x -> v.set(x));
 
                        // Replace with bean from:  
@RestInject(name="defaultResponseHeaders") public [static] HeaderList 
xxx(<args>)
-                       beanStore.createMethodFinder(HeaderList.class, 
resource.get()).addBean(HeaderList.class, v.get()).find(x -> 
isRestInjectMethod(x, "defaultResponseHeaders")).run(x -> v.set(x));
+                       new BeanCreateMethodFinder<>(HeaderList.class, 
resource.get(), beanStore).addBean(HeaderList.class, v.get()).find(x -> 
isRestInjectMethod(x, "defaultResponseHeaders")).run(x -> v.set(x));
 
                        return v.get();
                }
@@ -4068,7 +4067,7 @@ public class RestContext extends Context {
                        var v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestDestroy.class).collect(Collectors.toList())));
 
                        // Replace with bean from:  
@RestInject(name="destroyMethods") public [static] MethodList xxx(<args>)
-                       beanStore.createMethodFinder(MethodList.class, 
resource.get()).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "destroyMethods")).run(x -> v.set(x));
+                       new BeanCreateMethodFinder<>(MethodList.class, 
resource.get(), beanStore).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "destroyMethods")).run(x -> v.set(x));
 
                        return v.get();
                }
@@ -4100,7 +4099,7 @@ public class RestContext extends Context {
                        beanStore.getBean(EncoderSet.class).ifPresent(x -> 
v.get().impl(x));
 
                        // Replace with bean from:  @RestInject public [static] 
EncoderSet xxx(<args>)
-                       beanStore.createMethodFinder(EncoderSet.class, 
resource.get()).addBean(EncoderSet.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
+                       new BeanCreateMethodFinder<>(EncoderSet.class, 
resource.get(), beanStore).addBean(EncoderSet.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
 
                        return v.get();
                }
@@ -4120,7 +4119,7 @@ public class RestContext extends Context {
                        Value<MethodList> v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestEndCall.class).collect(Collectors.toList())));
 
                        // Replace with bean from:  
@RestInject(name="endCallMethods") public [static] MethodList xxx(<args>)
-                       beanStore.createMethodFinder(MethodList.class, 
resource.get()).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "endCallMethods")).run(x -> v.set(x));
+                       new BeanCreateMethodFinder<>(MethodList.class, 
resource.get(), beanStore).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "endCallMethods")).run(x -> v.set(x));
 
                        return v.get();
                }
@@ -4150,7 +4149,7 @@ public class RestContext extends Context {
                        
beanStore.getBean(JsonSchemaGenerator.class).ifPresent(x -> v.get().impl(x));
 
                        // Replace with bean from:  @RestInject public [static] 
JsonSchemaGenerator xxx(<args>)
-                       beanStore.createMethodFinder(JsonSchemaGenerator.class, 
resource.get()).addBean(JsonSchemaGenerator.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
+                       new BeanCreateMethodFinder<>(JsonSchemaGenerator.class, 
resource.get(), beanStore).addBean(JsonSchemaGenerator.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
 
                        return v.get();
                }
@@ -4180,7 +4179,7 @@ public class RestContext extends Context {
                        beanStore.getBean(Logger.class).ifPresent(x -> 
v.set(x));
 
                        // Replace with bean from:  @RestInject public [static] 
Logger xxx(<args>)
-                       beanStore.createMethodFinder(Logger.class, 
resource.get()).addBean(Logger.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.set(x));
+                       new BeanCreateMethodFinder<>(Logger.class, 
resource.get(), beanStore).addBean(Logger.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.set(x));
 
                        return v.get();
                }
@@ -4207,7 +4206,7 @@ public class RestContext extends Context {
                        beanStore.getBean(Messages.class).ifPresent(x -> 
v.get().impl(x));
 
                        // Replace with bean from:  @RestInject public [static] 
Messages xxx(<args>)
-                       beanStore.createMethodFinder(Messages.class, 
resource.get()).addBean(Messages.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
+                       new BeanCreateMethodFinder<>(Messages.class, 
resource.get(), beanStore).addBean(Messages.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
 
                        return v.get();
                }
@@ -4237,7 +4236,7 @@ public class RestContext extends Context {
                        beanStore.getBean(MethodExecStore.class).ifPresent(x -> 
v.get().impl(x));
 
                        // Replace with bean from:  @RestInject public [static] 
MethodExecStore xxx(<args>)
-                       beanStore.createMethodFinder(MethodExecStore.class, 
resource.get()).addBean(MethodExecStore.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
+                       new BeanCreateMethodFinder<>(MethodExecStore.class, 
resource.get(), beanStore).addBean(MethodExecStore.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
 
                        return v.get();
                }
@@ -4268,7 +4267,7 @@ public class RestContext extends Context {
                        beanStore.getBean(ParserSet.class).ifPresent(x -> 
v.get().impl(x));
 
                        // Replace with bean from:  @RestInject public [static] 
ParserSet xxx(<args>)
-                       beanStore.createMethodFinder(ParserSet.class, 
resource.get()).addBean(ParserSet.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
+                       new BeanCreateMethodFinder<>(ParserSet.class, 
resource.get(), beanStore).addBean(ParserSet.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
 
                        return v.get();
                }
@@ -4304,7 +4303,7 @@ public class RestContext extends Context {
                        defaultClasses().get(HttpPartParser.class).ifPresent(x 
-> v.get().type(x));
 
                        // Replace with bean from:  @RestInject public [static] 
HttpPartParser xxx(<args>)
-                       beanStore.createMethodFinder(HttpPartParser.class, 
resource.get()).addBean(HttpPartParser.Creator.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
+                       new BeanCreateMethodFinder<>(HttpPartParser.class, 
resource.get(), beanStore).addBean(HttpPartParser.Creator.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
 
                        return v.get();
                }
@@ -4340,7 +4339,7 @@ public class RestContext extends Context {
                        
defaultClasses().get(HttpPartSerializer.class).ifPresent(x -> v.get().type(x));
 
                        // Replace with bean from:  @RestInject public [static] 
HttpPartSerializer xxx(<args>)
-                       beanStore.createMethodFinder(HttpPartSerializer.class, 
resource.get()).addBean(HttpPartSerializer.Creator.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
+                       new BeanCreateMethodFinder<>(HttpPartSerializer.class, 
resource.get(), beanStore).addBean(HttpPartSerializer.Creator.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
 
                        return v.get();
                }
@@ -4360,7 +4359,7 @@ public class RestContext extends Context {
                        Value<MethodList> v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestPostCall.class).collect(Collectors.toList())));
 
                        // Replace with bean from:  
@RestInject(name="postCallMethods") public [static] MethodList xxx(<args>)
-                       beanStore.createMethodFinder(MethodList.class, 
resource.get()).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "postCallMethods")).run(x -> v.set(x));
+                       new BeanCreateMethodFinder<>(MethodList.class, 
resource.get(), beanStore).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "postCallMethods")).run(x -> v.set(x));
 
                        return v.get();
                }
@@ -4388,7 +4387,7 @@ public class RestContext extends Context {
                                .collect(Collectors.toList())));
 
                        // Replace with bean from:  
@RestInject(name="postInitChildFirstMethods") public [static] MethodList 
xxx(<args>)
-                       beanStore.createMethodFinder(MethodList.class, 
resource.get()).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "postInitChildFirstMethods")).run(x -> v.set(x));
+                       new BeanCreateMethodFinder<>(MethodList.class, 
resource.get(), beanStore).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "postInitChildFirstMethods")).run(x -> v.set(x));
 
                        return v.get();
                }
@@ -4416,7 +4415,7 @@ public class RestContext extends Context {
                                .collect(Collectors.toList())));
 
                        // Replace with bean from:  
@RestInject(name="postInitMethods") public [static] MethodList xxx(<args>)
-                       beanStore.createMethodFinder(MethodList.class, 
resource.get()).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "postInitMethods")).run(x -> v.set(x));
+                       new BeanCreateMethodFinder<>(MethodList.class, 
resource.get(), beanStore).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "postInitMethods")).run(x -> v.set(x));
 
                        return v.get();
                }
@@ -4436,7 +4435,7 @@ public class RestContext extends Context {
                        Value<MethodList> v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestPreCall.class).collect(Collectors.toList())));
 
                        // Replace with bean from:  
@RestInject(name="preCallMethods") public [static] MethodList xxx(<args>)
-                       beanStore.createMethodFinder(MethodList.class, 
resource.get()).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "preCallMethods")).run(x -> v.set(x));
+                       new BeanCreateMethodFinder<>(MethodList.class, 
resource.get(), beanStore).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "preCallMethods")).run(x -> v.set(x));
 
                        return v.get();
                }
@@ -4479,7 +4478,7 @@ public class RestContext extends Context {
                        
beanStore.getBean(ResponseProcessorList.class).ifPresent(x -> v.get().impl(x));
 
                        // Replace with bean from:  @RestInject public [static] 
ResponseProcessorList xxx(<args>)
-                       
beanStore.createMethodFinder(ResponseProcessorList.class, 
resource.get()).addBean(ResponseProcessorList.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
+                       new 
BeanCreateMethodFinder<>(ResponseProcessorList.class, resource.get(), 
beanStore).addBean(ResponseProcessorList.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
 
                        return v.get();
                }
@@ -4542,7 +4541,7 @@ public class RestContext extends Context {
                        }
 
                        // Replace with bean from:  @RestInject public [static] 
RestChildren xxx(<args>)
-                       beanStore.createMethodFinder(RestChildren.class, 
resource.get()).addBean(RestChildren.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
+                       new BeanCreateMethodFinder<>(RestChildren.class, 
resource.get(), beanStore).addBean(RestChildren.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
 
                        return v.get();
                }
@@ -4581,7 +4580,7 @@ public class RestContext extends Context {
                        beanStore.getBean(RestOpArgList.class).ifPresent(x -> 
v.get().impl(x));
 
                        // Replace with bean from:  @RestInject public [static] 
RestOpArgList xxx(<args>)
-                       beanStore.createMethodFinder(RestOpArgList.class, 
resource.get()).addBean(RestOpArgList.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
+                       new BeanCreateMethodFinder<>(RestOpArgList.class, 
resource.get(), beanStore).addBean(RestOpArgList.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
 
                        return v.get();
                }
@@ -4680,7 +4679,7 @@ public class RestContext extends Context {
                        }
 
                        // Replace with bean from:  @RestInject public [static] 
RestOperations xxx(<args>)
-                       beanStore.createMethodFinder(RestOperations.class, 
resource.get()).addBean(RestOperations.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
+                       new BeanCreateMethodFinder<>(RestOperations.class, 
resource.get(), beanStore).addBean(RestOperations.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
 
                        return v.get();
                }
@@ -4711,7 +4710,7 @@ public class RestContext extends Context {
                        beanStore.getBean(SerializerSet.class).ifPresent(x -> 
v.get().impl(x));
 
                        // Replace with bean from:  @RestInject public [static] 
SerializerSet xxx(<args>)
-                       beanStore.createMethodFinder(SerializerSet.class, 
resource.get()).addBean(SerializerSet.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
+                       new BeanCreateMethodFinder<>(SerializerSet.class, 
resource.get(), beanStore).addBean(SerializerSet.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
 
                        return v.get();
                }
@@ -4731,7 +4730,7 @@ public class RestContext extends Context {
                        Value<MethodList> v = 
Value.of(MethodList.of(getAnnotatedMethods(resource, 
RestStartCall.class).collect(Collectors.toList())));
 
                        // Replace with bean from:  
@RestInject(name="startCallMethods") public [static] MethodList xxx(<args>)
-                       beanStore.createMethodFinder(MethodList.class, 
resource.get()).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "startCallMethods")).run(x -> v.set(x));
+                       new BeanCreateMethodFinder<>(MethodList.class, 
resource.get(), beanStore).addBean(MethodList.class, v.get()).find(x -> 
isRestInjectMethod(x, "startCallMethods")).run(x -> v.set(x));
 
                        return v.get();
                }
@@ -4759,7 +4758,7 @@ public class RestContext extends Context {
                        beanStore.getBean(StaticFiles.class).ifPresent(x -> 
creator.impl(x));
 
                        // Replace with bean from:  @RestInject public [static] 
StaticFiles xxx(<args>)
-                       beanStore.createMethodFinder(StaticFiles.class, 
resource.get()).find(Builder::isRestInjectMethod).run(x -> creator.impl(x));
+                       new BeanCreateMethodFinder<>(StaticFiles.class, 
resource.get(), beanStore).find(Builder::isRestInjectMethod).run(x -> 
creator.impl(x));
 
                        return creator;
                }
@@ -4808,7 +4807,7 @@ public class RestContext extends Context {
                        beanStore.getBean(SwaggerProvider.class).ifPresent(x -> 
creator.impl(x));
 
                        // Replace with bean from:  @RestInject public [static] 
SwaggerProvider xxx(<args>)
-                       beanStore.createMethodFinder(SwaggerProvider.class, 
resource.get()).find(Builder::isRestInjectMethod).run(x -> creator.impl(x));
+                       new BeanCreateMethodFinder<>(SwaggerProvider.class, 
resource.get(), beanStore).find(Builder::isRestInjectMethod).run(x -> 
creator.impl(x));
 
                        return creator;
                }
@@ -4842,7 +4841,7 @@ public class RestContext extends Context {
                        beanStore.getBean(ThrownStore.class).ifPresent(x -> 
v.get().impl(x));
 
                        // Replace with bean from:  @RestInject public [static] 
ThrownStore xxx(<args>)
-                       beanStore.createMethodFinder(ThrownStore.class, 
resource.get()).addBean(ThrownStore.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
+                       new BeanCreateMethodFinder<>(ThrownStore.class, 
resource.get(), beanStore).addBean(ThrownStore.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
 
                        return v.get();
                }
@@ -4899,7 +4898,7 @@ public class RestContext extends Context {
                        beanStore.getBean(VarResolver.class).ifPresent(x -> 
v.get().impl(x));
 
                        // Replace with bean from:  @RestInject public [static] 
VarResolver xxx(<args>)
-                       beanStore.createMethodFinder(VarResolver.class, 
resource.get()).addBean(VarResolver.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
+                       new BeanCreateMethodFinder<>(VarResolver.class, 
resource.get(), beanStore).addBean(VarResolver.Builder.class, 
v.get()).find(Builder::isRestInjectMethod).run(x -> v.get().impl(x));
 
                        return v.get();
                }
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
index aaeb3c0d2e..77fe6bd40a 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
@@ -1419,10 +1419,8 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(methodScope="foo") public [static] BeanContext xxx(<args>)
                        // @formatter:off
-                       BasicBeanStore
-                               .of(beanStore, resource)
-                               .addBean(BeanContext.Builder.class, v.get())
-                               .createMethodFinder(BeanContext.class, resource)
+                       var bs = BasicBeanStore.of(beanStore, 
resource).addBean(BeanContext.Builder.class, v.get());
+                       new BeanCreateMethodFinder<>(BeanContext.class, 
resource, bs)
                                .find(this::matches)
                                .run(x -> v.get().impl(x));
                        // @formatter:on
@@ -1519,7 +1517,7 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
                        beanStore.getBean(RestConverterList.class).ifPresent(x 
-> v.get().impl(x));
 
                        // Replace with bean from:  
@RestInject(methodScope="foo") public [static] RestConverterList xxx(<args>)
-                       beanStore.createMethodFinder(RestConverterList.class, 
resource.get()).addBean(RestConverterList.Builder.class, 
v.get()).find(this::matches).run(x -> v.get().impl(x));
+                       new BeanCreateMethodFinder<>(RestConverterList.class, 
resource.get(), beanStore).addBean(RestConverterList.Builder.class, 
v.get()).find(this::matches).run(x -> v.get().impl(x));
 
                        return v.get();
                }
@@ -1541,10 +1539,8 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(name="defaultRequestAttributes",methodScope="foo") public [static] 
NamedAttributeMap xxx(<args>)
                        // @formatter:off
-                       BasicBeanStore
-                               .of(beanStore, resource)
-                               .addBean(NamedAttributeMap.class, v.get())
-                               .createMethodFinder(NamedAttributeMap.class, 
resource)
+                       var bs = BasicBeanStore.of(beanStore, 
resource).addBean(NamedAttributeMap.class, v.get());
+                       new BeanCreateMethodFinder<>(NamedAttributeMap.class, 
resource, bs)
                                .find(x -> matches(x, 
"defaultRequestAttributes"))
                                .run(x -> v.set(x));
                        // @formatter:on
@@ -1569,10 +1565,8 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(name="defaultRequestFormData",methodScope="foo") public [static] 
PartList xxx(<args>)
                        // @formatter:off
-                       BasicBeanStore
-                               .of(beanStore, resource)
-                               .addBean(PartList.class, v.get())
-                               .createMethodFinder(PartList.class, resource)
+                       var bs = BasicBeanStore.of(beanStore, 
resource).addBean(PartList.class, v.get());
+                       new BeanCreateMethodFinder<>(PartList.class, resource, 
bs)
                                .find(x -> matches(x, "defaultRequestFormData"))
                                .run(x -> v.set(x));
                        // @formatter:on
@@ -1597,10 +1591,8 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(name="defaultRequestHeaders",methodScope="foo") public [static] 
HeaderList xxx(<args>)
                        // @formatter:off
-                       BasicBeanStore
-                               .of(beanStore, resource)
-                               .addBean(HeaderList.class, v.get())
-                               .createMethodFinder(HeaderList.class, resource)
+                       var bs = BasicBeanStore.of(beanStore, 
resource).addBean(HeaderList.class, v.get());
+                       new BeanCreateMethodFinder<>(HeaderList.class, 
resource, bs)
                                .find(x -> matches(x, "defaultRequestHeaders"))
                                .run(x -> v.set(x));
                        // @formatter:on
@@ -1625,10 +1617,8 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(name="defaultRequestQueryData",methodScope="foo") public [static] 
PartList xxx(<args>)
                        // @formatter:off
-                       BasicBeanStore
-                               .of(beanStore, resource)
-                               .addBean(PartList.class, v.get())
-                               .createMethodFinder(PartList.class, resource)
+                       var bs = BasicBeanStore.of(beanStore, 
resource).addBean(PartList.class, v.get());
+                       new BeanCreateMethodFinder<>(PartList.class, resource, 
bs)
                                .find(x -> matches(x, 
"defaultRequestQueryData"))
                                .run(x -> v.set(x));
                        // @formatter:on
@@ -1653,10 +1643,8 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(name="defaultResponseHeaders",methodScope="foo") public [static] 
HeaderList xxx(<args>)
                        // @formatter:off
-                       BasicBeanStore
-                               .of(beanStore, resource)
-                               .addBean(HeaderList.class, v.get())
-                               .createMethodFinder(HeaderList.class, resource)
+                       var bs = BasicBeanStore.of(beanStore, 
resource).addBean(HeaderList.class, v.get());
+                       new BeanCreateMethodFinder<>(HeaderList.class, 
resource, bs)
                                .find(x -> matches(x, "defaultResponseHeaders"))
                                .run(x -> v.set(x));
                        // @formatter:on
@@ -1682,10 +1670,8 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(methodScope="foo") public [static] EncoderSet xxx(<args>)
                        // @formatter:off
-                       BasicBeanStore
-                               .of(beanStore, resource)
-                               .addBean(EncoderSet.Builder.class, v.get())
-                               .createMethodFinder(EncoderSet.class, resource)
+                       var bs = BasicBeanStore.of(beanStore, 
resource).addBean(EncoderSet.Builder.class, v.get());
+                       new BeanCreateMethodFinder<>(EncoderSet.class, 
resource, bs)
                                .find(this::matches)
                                .run(x -> v.get().impl(x));
                        // @formatter:on
@@ -1736,8 +1722,7 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(methodScope="foo") public [static] RestGuardList xxx(<args>)
                        // @formatter:off
-                       beanStore
-                               .createMethodFinder(RestGuardList.class, 
resource.get())
+                       new BeanCreateMethodFinder<>(RestGuardList.class, 
resource.get(), beanStore)
                                .addBean(RestGuardList.Builder.class, v.get())
                                .find(m -> this.matches(m))
                                .run(x -> v.get().impl(x));
@@ -1764,10 +1749,8 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(methodScope="foo") public [static] JsonSchemaGenerator xxx(<args>)
                        // @formatter:off
-                       BasicBeanStore
-                               .of(beanStore, resource)
-                               .addBean(JsonSchemaGenerator.Builder.class, 
v.get())
-                               .createMethodFinder(JsonSchemaGenerator.class, 
resource)
+                       var bs = BasicBeanStore.of(beanStore, 
resource).addBean(JsonSchemaGenerator.Builder.class, v.get());
+                       new BeanCreateMethodFinder<>(JsonSchemaGenerator.class, 
resource, bs)
                                .find(this::matches)
                                .run(x -> v.get().impl(x));
                        // @formatter:on
@@ -1844,8 +1827,7 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(methodScope="foo") public [static] RestMatcherList xxx(<args>)
                        // @formatter:off
-                       beanStore
-                               .createMethodFinder(RestMatcherList.class, 
resource.get())
+                       new BeanCreateMethodFinder<>(RestMatcherList.class, 
resource.get(), beanStore)
                                .addBean(RestMatcherList.Builder.class, v.get())
                                .find(this::matches)
                                .run(x -> v.get().impl(x));
@@ -1872,10 +1854,8 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(methodScope="foo") public [static] ParserSet xxx(<args>)
                        // @formatter:off
-                       BasicBeanStore
-                               .of(beanStore, resource)
-                               .addBean(ParserSet.Builder.class, v.get())
-                               .createMethodFinder(ParserSet.class, resource)
+                       var bs = BasicBeanStore.of(beanStore, 
resource).addBean(ParserSet.Builder.class, v.get());
+                       new BeanCreateMethodFinder<>(ParserSet.class, resource, 
bs)
                                .find(this::matches)
                                .run(x -> v.get().impl(x));
                        // @formatter:on
@@ -1901,10 +1881,8 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(methodScope="foo") public [static] HttpPartParser xxx(<args>)
                        // @formatter:off
-                       BasicBeanStore
-                               .of(beanStore, resource)
-                               .addBean(HttpPartParser.Creator.class, v.get())
-                               .createMethodFinder(HttpPartParser.class, 
resource)
+                       var bs = BasicBeanStore.of(beanStore, 
resource).addBean(HttpPartParser.Creator.class, v.get());
+                       new BeanCreateMethodFinder<>(HttpPartParser.class, 
resource, bs)
                                .find(this::matches)
                                .run(x -> v.get().impl(x));
                        // @formatter:on
@@ -1930,10 +1908,8 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(methodScope="foo") public [static] HttpPartSerializer xxx(<args>)
                        // @formatter:off
-                       BasicBeanStore
-                               .of(beanStore, resource)
-                               .addBean(HttpPartSerializer.Creator.class, 
v.get())
-                               .createMethodFinder(HttpPartSerializer.class, 
resource)
+                       var bs = BasicBeanStore.of(beanStore, 
resource).addBean(HttpPartSerializer.Creator.class, v.get());
+                       new BeanCreateMethodFinder<>(HttpPartSerializer.class, 
resource, bs)
                                .find(this::matches)
                                .run(x -> v.get().impl(x));
                        // @formatter:on
@@ -1959,10 +1935,8 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(methodScope="foo") public [static] SerializerSet xxx(<args>)
                        // @formatter:off
-                       BasicBeanStore
-                               .of(beanStore, resource)
-                               .addBean(SerializerSet.Builder.class, v.get())
-                               .createMethodFinder(SerializerSet.class, 
resource)
+                       var bs = BasicBeanStore.of(beanStore, 
resource).addBean(SerializerSet.Builder.class, v.get());
+                       new BeanCreateMethodFinder<>(SerializerSet.class, 
resource, bs)
                                .find(this::matches)
                                .run(x -> v.get().impl(x));
                        // @formatter:on
@@ -2027,8 +2001,7 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
 
                        // Replace with bean from:  
@RestInject(methodScope="foo") public [static] UrlPathMatcherList xxx(<args>)
                        // @formatter:off
-                       beanStore
-                               .createMethodFinder(UrlPathMatcherList.class, 
resource().get())
+                       new BeanCreateMethodFinder<>(UrlPathMatcherList.class, 
resource().get(), beanStore())
                                .addBean(UrlPathMatcherList.class, v.get())
                                .find(this::matches)
                                .run(x -> v.set(x));
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/cp/BeanStore_Test.java 
b/juneau-utest/src/test/java/org/apache/juneau/cp/BeanStore_Test.java
index 9eb6078bd7..c262868229 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/cp/BeanStore_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/cp/BeanStore_Test.java
@@ -490,9 +490,9 @@ class BeanStore_Test extends TestBase {
 
        @Test void c00_createMethodFinder_invalidArgs() {
                var b = BasicBeanStore.create().build();
-//             assertThrowsWithMessage(IllegalArgumentException.class, "Method 
cannot be used without outer bean definition.", ()->b.createMethodFinder(null));
-               assertThrowsWithMessage(IllegalArgumentException.class, 
"Argument 'beanType' cannot be null.", 
()->b.createMethodFinder((Class<?>)null,""));
-               assertThrowsWithMessage(IllegalArgumentException.class, 
"Argument 'resourceClass' cannot be null.", 
()->b.createMethodFinder(String.class,null));
+//             assertThrowsWithMessage(IllegalArgumentException.class, "Method 
cannot be used without outer bean definition.", ()->new 
BeanCreateMethodFinder<>(null, b));
+               assertThrowsWithMessage(IllegalArgumentException.class, 
"Argument 'beanType' cannot be null.", ()->new 
BeanCreateMethodFinder<>((Class<?>)null, "", b));
+               assertThrowsWithMessage(IllegalArgumentException.class, 
"Argument 'resourceClass' cannot be null.", ()->new 
BeanCreateMethodFinder<>(String.class, null, b));
        }
 
        // Instance methods.


Reply via email to