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

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


The following commit(s) were added to refs/heads/jbFixRestNpe by this push:
     new e8faf0a4b Improvements to @RestBean annotation
e8faf0a4b is described below

commit e8faf0a4b51d86579d4a7b9d020a8d3871fa055e
Author: JamesBognar <[email protected]>
AuthorDate: Mon Jul 18 12:12:42 2022 -0400

    Improvements to @RestBean annotation
---
 .../main/java/org/apache/juneau/cp/BeanStore.java  |   2 +-
 .../java/org/apache/juneau/cp/BeanStoreEntry.java  |   3 +-
 juneau-doc/src/main/javadoc/overview.html          |   4 +-
 .../java/org/apache/juneau/rest/RestContext.java   | 301 +++++++++++++--------
 .../java/org/apache/juneau/rest/RestOpContext.java |   8 +-
 .../apache/juneau/rest/annotation/RestBean.java    | 118 +++++++-
 .../juneau/rest/annotation/RestMethodBean.java     |  44 ---
 7 files changed, 316 insertions(+), 164 deletions(-)

diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanStore.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanStore.java
index b4a91a4ef..b1c115fd6 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanStore.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanStore.java
@@ -352,7 +352,7 @@ public class BeanStore {
                BeanStoreEntry<T> e = createEntry(beanType, bean, name);
                try (SimpleLock x = lock.write()) {
                        entries.addFirst(e);
-                       if (name == null)
+                       if (isEmpty(name))
                                unnamedEntries.put(beanType, e);
                }
                return this;
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanStoreEntry.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanStoreEntry.java
index d12cbb213..4c4b593e6 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanStoreEntry.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanStoreEntry.java
@@ -15,6 +15,7 @@ package org.apache.juneau.cp;
 import static org.apache.juneau.collections.JsonMap.*;
 import static org.apache.juneau.internal.ArgUtils.*;
 import static org.apache.juneau.internal.ClassUtils.*;
+import static org.apache.juneau.internal.StringUtils.*;
 
 import java.util.function.*;
 
@@ -71,7 +72,7 @@ public class BeanStoreEntry<T> {
        protected BeanStoreEntry(Class<T> type, Supplier<T> bean, String name) {
                this.bean = assertArgNotNull("bean", bean);
                this.type = assertArgNotNull("type", type);
-               this.name = name;
+               this.name = nullIfEmpty(name);
        }
 
        /**
diff --git a/juneau-doc/src/main/javadoc/overview.html 
b/juneau-doc/src/main/javadoc/overview.html
index 74b303c0c..5c8477295 100644
--- a/juneau-doc/src/main/javadoc/overview.html
+++ b/juneau-doc/src/main/javadoc/overview.html
@@ -22983,7 +22983,7 @@
        )
        <jk>public class</jk> HelloWorldResource <jk>extends</jk> 
BasicRestObject <jk>implements</jk> BasicUniversalConfig {
        
-               <ja>@Inject</ja>
+               <ja>@Autowired</ja>
                <jk>private</jk> HelloWorldMessageProvider 
<jf>messageProvider</jf>;
        
                <ja>@RestGet</ja>(path=<js>"/*"</js>, summary=<js>"Responds 
with injected message"</js>)
@@ -28384,7 +28384,7 @@
        )
        <jk>public class</jk> PetStoreResource <jk>extends</jk> BasicRestObject 
<jk>implements</jk> BasicUniversalConfig, PetStore {
        
-               <ja>@Inject</ja>
+               <ja>@Autowired</ja>
                <jk>private</jk> PetStoreService <jf>store</jf>;
        
                <jd>/**
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 e9233a5df..bab38267a 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
@@ -204,6 +204,66 @@ public class RestContext extends Context {
                        }
                }
 
+               private static final Set<Class<?>> DELAYED_INJECTION = set(
+                       BeanContext.Builder.class,
+                       BeanStore.Builder.class,
+                       BeanStore.class,
+                       CallLogger.Builder.class,
+                       CallLogger.class,
+                       Config.class,
+                       DebugEnablement.Builder.class,
+                       DebugEnablement.class,
+                       EncoderSet.Builder.class,
+                       EncoderSet.class,
+                       FileFinder.Builder.class,
+                       FileFinder.class,
+                       HttpPartParser.class,
+                       HttpPartParser.Creator.class,
+                       HttpPartSerializer.class,
+                       HttpPartSerializer.Creator.class,
+                       JsonSchemaGenerator.Builder.class,
+                       JsonSchemaGenerator.class,
+                       Logger.class,
+                       Messages.Builder.class,
+                       Messages.class,
+                       MethodExecStore.Builder.class,
+                       MethodExecStore.class,
+                       ParserSet.Builder.class,
+                       ParserSet.class,
+                       ResponseProcessorList.Builder.class,
+                       ResponseProcessorList.class,
+                       RestChildren.Builder.class,
+                       RestChildren.class,
+                       RestOpArgList.Builder.class,
+                       RestOpArgList.class,
+                       RestOperations.Builder.class,
+                       RestOperations.class,
+                       SerializerSet.Builder.class,
+                       SerializerSet.class,
+                       StaticFiles.Builder.class,
+                       StaticFiles.class,
+                       SwaggerProvider.Builder.class,
+                       SwaggerProvider.class,
+                       ThrownStore.Builder.class,
+                       ThrownStore.class,
+                       VarList.class,
+                       VarResolver.Builder.class,
+                       VarResolver.class
+               );
+
+               private static final Set<String> DELAYED_INJECTION_NAMES = set(
+                       "defaultRequestAttributes",
+                       "defaultRequestHeaders",
+                       "defaultResponseHeaders",
+                       "destroyMethods",
+                       "endCallMethods",
+                       "postCallMethods",
+                       "postInitChildFirstMethods",
+                       "postInitMethods",
+                       "preCallMethods",
+                       "startCallMethods"
+               );
+
                
//-----------------------------------------------------------------------------------------------------------------
                // The following fields are meant to be modifiable.
                // They should not be declared final.
@@ -349,6 +409,17 @@ public class RestContext extends Context {
 
                        ClassInfo rci = ClassInfo.of(resourceClass);
 
+                       rci.forEachMethod(x -> x.hasAnnotation(RestBean.class), 
x -> {
+                               Class<Object> rt = x.getReturnType().inner();
+                               String name = 
x.getAnnotation(RestBean.class).name();
+                               if (! (DELAYED_INJECTION.contains(rt) || 
DELAYED_INJECTION_NAMES.contains(name))) {
+                                       beanStore
+                                               .createMethodFinder(rt)
+                                               .find(Builder::isRestBeanMethod)
+                                               .run(y -> beanStore.add(rt, y, 
name));
+                               }
+                       });
+
                        VarResolverSession vrs = 
varResolver().build().createSession();
                        AnnotationWorkList work = AnnotationWorkList.of(vrs, 
rci.getAnnotationList(CONTEXT_APPLY_FILTER));
 
@@ -585,16 +656,16 @@ public class RestContext extends Context {
                        // Apply @Rest(beanStore).
                        
ClassInfo.of(resourceClass).forEachAnnotation(Rest.class, x -> 
isNotVoid(x.beanStore()), x -> v.get().type(x.beanStore()));
 
-                       // Replace with builder from:  public [static] 
BeanStore.Builder createBeanStore(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] BeanStore.Builder xxx(<args>)
                        v.get().build()
                                .createMethodFinder(BeanStore.Builder.class)
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] BeanStore 
createBeanStore(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
BeanStore xxx(<args>)
                        v.get().build()
                                .createMethodFinder(BeanStore.class)
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -707,17 +778,17 @@ public class RestContext extends Context {
                                .getBean(VarResolver.class)
                                .ifPresent(x -> v.get().impl(x));
 
-                       // Replace with builder from:  public [static] 
VarResolver.Builder createVarResolver(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] VarResolver.Builder xxx(<args>)
                        beanStore
                                .createMethodFinder(VarResolver.Builder.class)
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] VarResolver 
createVarResolver(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
VarResolver xxx(<args>)
                        beanStore
                                .createMethodFinder(VarResolver.class)
                                .addBean(VarResolver.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -774,11 +845,11 @@ public class RestContext extends Context {
                                .map(x -> x.copy())
                                .ifPresent(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] VarList 
createVars(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
VarList xxx(<args>)
                        beanStore
                                .createMethodFinder(VarList.class)
                                .addBean(VarList.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
                        return v.get();
@@ -884,11 +955,11 @@ public class RestContext extends Context {
                                .getBean(Config.class)
                                .ifPresent(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] Config 
createConfig(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
Config xxx(<args>)
                        beanStore
                                .createMethodFinder(Config.class)
                                .addBean(Config.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
                        return v.get();
@@ -982,11 +1053,11 @@ public class RestContext extends Context {
                                .getBean(Logger.class)
                                .ifPresent(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] Logger 
createLogger(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
Logger xxx(<args>)
                        beanStore
                                .createMethodFinder(Logger.class)
                                .addBean(Logger.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
                        return v.get();
@@ -1075,18 +1146,18 @@ public class RestContext extends Context {
                                .getBean(ThrownStore.class)
                                .ifPresent(x->v.get().impl(x));
 
-                       // Replace with builder from:  public [static] 
ThrownStore.Builder createThrownStore(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] ThrownStore.Builder xxx(<args>)
                        beanStore
                                .createMethodFinder(ThrownStore.Builder.class)
                                .addBean(ThrownStore.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] ThrownStore 
createThrownStore(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
ThrownStore xxx(<args>)
                        beanStore
                                .createMethodFinder(ThrownStore.class)
                                .addBean(ThrownStore.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -1179,18 +1250,18 @@ public class RestContext extends Context {
                                .getBean(EncoderSet.class)
                                .ifPresent(x->v.get().impl(x));
 
-                       // Replace with builder from:  public [static] 
EncoderSet.Builder createEncoders(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] EncoderSet.Builder xxx(<args>)
                        beanStore
                                .createMethodFinder(EncoderSet.Builder.class)
                                .addBean(EncoderSet.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] EncoderSet 
createEncoders(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
EncoderSet xxx(<args>)
                        beanStore
                                .createMethodFinder(EncoderSet.class)
                                .addBean(EncoderSet.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -1261,18 +1332,18 @@ public class RestContext extends Context {
                                .getBean(SerializerSet.class)
                                .ifPresent(x->v.get().impl(x));
 
-                       // Replace with builder from:  public [static] 
SerializerSet.Builder createSerializers(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] SerializerSet.Builder xxx(<args>)
                        beanStore
                                .createMethodFinder(SerializerSet.Builder.class)
                                .addBean(SerializerSet.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] 
SerializerSet createSerializers(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
SerializerSet xxx(<args>)
                        beanStore
                                .createMethodFinder(SerializerSet.class)
                                .addBean(SerializerSet.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -1343,18 +1414,18 @@ public class RestContext extends Context {
                                .getBean(ParserSet.class)
                                .ifPresent(x->v.get().impl(x));
 
-                       // Replace with builder from:  public [static] 
ParserSet.Builder createParsers(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] ParserSet.Builder xxx(<args>)
                        beanStore
                                .createMethodFinder(ParserSet.Builder.class)
                                .addBean(ParserSet.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] ParserSet 
createParsers(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
ParserSet xxx(<args>)
                        beanStore
                                .createMethodFinder(ParserSet.class)
                                .addBean(ParserSet.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -1424,18 +1495,18 @@ public class RestContext extends Context {
                                .getBean(MethodExecStore.class)
                                .ifPresent(x->v.get().impl(x));
 
-                       // Replace with builder from:  public [static] 
MethodExecStore.Builder createThrownStore(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] MethodExecStore.Builder xxx(<args>)
                        beanStore
                                
.createMethodFinder(MethodExecStore.Builder.class)
                                .addBean(MethodExecStore.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] 
MethodExecStore createThrownStore(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
MethodExecStore xxx(<args>)
                        beanStore
                                .createMethodFinder(MethodExecStore.class)
                                .addBean(MethodExecStore.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -1573,17 +1644,17 @@ public class RestContext extends Context {
                                .getBean(Messages.class)
                                .ifPresent(x->v.get().impl(x));
 
-                       // Replace with builder from:  public [static] 
Messages.Builder createMessages(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] Messages.Builder xxx(<args>)
                        beanStore
                                .createMethodFinder(Messages.Builder.class)
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] Messages 
createMessages(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
Messages xxx(<args>)
                        beanStore
                                .createMethodFinder(Messages.class)
                                .addBean(Messages.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -1759,18 +1830,18 @@ public class RestContext extends Context {
                                .getBean(ResponseProcessorList.class)
                                .ifPresent(x -> v.get().impl(x));
 
-                       // Replace with builder from:  public [static] 
ResponseProcessorList.Builder createResponseProcessors(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] ResponseProcessorList.Builder xxx(<args>)
                        beanStore
                                
.createMethodFinder(ResponseProcessorList.Builder.class)
                                .addBean(ResponseProcessorList.Builder.class, 
v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] 
ResponseProcessorList createResponseProcessors(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
ResponseProcessorList xxx(<args>)
                        beanStore
                                .createMethodFinder(ResponseProcessorList.class)
                                .addBean(ResponseProcessorList.Builder.class, 
v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -1918,10 +1989,10 @@ public class RestContext extends Context {
                                .getBean(CallLogger.class)
                                .ifPresent(x -> creator.impl(x));
 
-                       // Replace with bean from:  public [static] CallLogger 
createCallLogger(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
CallLogger xxx(<args>)
                        beanStore
                                .createMethodFinder(CallLogger.class)
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> creator.impl(x));
 
                        return creator;
@@ -2011,11 +2082,11 @@ public class RestContext extends Context {
                                .getBean(BeanContext.class)
                                .ifPresent(x -> v.get().impl(x));
 
-                       // Replace with builder from:  public [static] 
BeanContext.Builder createBeanContext(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] BeanContext.Builder xxx(<args>)
                        beanStore
                                .createMethodFinder(BeanContext.Builder.class)
                                .addBean(BeanContext.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
                        return v.get();
@@ -2116,18 +2187,18 @@ public class RestContext extends Context {
                                .get(HttpPartSerializer.class)
                                .ifPresent(x -> v.get().type(x));
 
-                       // Replace with builder from:  public [static] 
HttpPartSerializer.Creator createPartSerializer(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] HttpPartSerializer.Creator xxx(<args>)
                        beanStore
                                
.createMethodFinder(HttpPartSerializer.Creator.class)
                                .addBean(HttpPartSerializer.Creator.class, 
v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] 
HttpPartSerializer createPartSerializer(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
HttpPartSerializer xxx(<args>)
                        beanStore
                                .createMethodFinder(HttpPartSerializer.class)
                                .addBean(HttpPartSerializer.Creator.class, 
v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -2228,18 +2299,18 @@ public class RestContext extends Context {
                                .get(HttpPartParser.class)
                                .ifPresent(x -> v.get().type(x));
 
-                       // Replace with builder from:  public [static] 
HttpPartParser.Creator createPartParser(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] HttpPartParser.Creator xxx(<args>)
                        beanStore
                                
.createMethodFinder(HttpPartParser.Creator.class)
                                .addBean(HttpPartParser.Creator.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] 
HttpPartParser createPartParser(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
HttpPartParser xxx(<args>)
                        beanStore
                                .createMethodFinder(HttpPartParser.class)
                                .addBean(HttpPartParser.Creator.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -2323,18 +2394,18 @@ public class RestContext extends Context {
                                .getBean(JsonSchemaGenerator.class)
                                .ifPresent(x -> v.get().impl(x));
 
-                       // Replace with builder from:  public [static] 
JsonSchemaGeneratorBuilder createJsonSchemaGenerator(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] JsonSchemaGeneratorBuilder xxx(<args>)
                        beanStore
                                
.createMethodFinder(JsonSchemaGenerator.Builder.class)
                                .addBean(JsonSchemaGenerator.Builder.class, 
v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] 
JsonSchemaGenerator createJsonSchemaGenerator(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
JsonSchemaGenerator xxx(<args>)
                        beanStore
                                .createMethodFinder(JsonSchemaGenerator.class)
                                .addBean(JsonSchemaGenerator.Builder.class, 
v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -2512,10 +2583,10 @@ public class RestContext extends Context {
                                .getBean(FileFinder.class)
                                .ifPresent(x -> creator.impl(x));
 
-                       // Replace with bean from:  public [static] FileFinder 
createFileFinder(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
FileFinder xxx(<args>)
                        beanStore
                                .createMethodFinder(FileFinder.class)
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> creator.impl(x));
 
                        return creator;
@@ -2665,10 +2736,10 @@ public class RestContext extends Context {
                                .getBean(StaticFiles.class)
                                .ifPresent(x -> creator.impl(x));
 
-                       // Replace with bean from:  public [static] StaticFiles 
createStaticFiles(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
StaticFiles xxx(<args>)
                        beanStore
                                .createMethodFinder(StaticFiles.class)
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> creator.impl(x));
 
                        return creator;
@@ -2820,21 +2891,21 @@ public class RestContext extends Context {
 
                        // Replace with bean from bean store.
                        rootBeanStore
-                               .getBean(HeaderList.class, 
"RestContext.defaultRequestHeaders")
+                               .getBean(HeaderList.class, 
"defaultRequestHeaders")
                                .ifPresent(x -> v.get().impl(x));
 
-                       // Replace with builder from:  public [static] 
HeaderList.Builder createDefaultRequestHeaders(<args>)
+                       // Replace with builder from:  
@RestBean(name="defaultRequestHeaders") public [static] HeaderList.Builder 
xxx(<args>)
                        beanStore
                                .createMethodFinder(HeaderList.Builder.class)
                                .addBean(HeaderList.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class) && 
x.getAnnotation(RestBean.class).name().equals("defaultRequestHeaders"))
+                               .find(x -> isRestBeanMethod(x, 
"defaultRequestHeaders"))
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] HeaderList 
createDefaultRequestHeaders(<args>)
+                       // Replace with bean from:  
@RestBean(name="defaultRequestHeaders") public [static] HeaderList xxx(<args>)
                        beanStore
                                .createMethodFinder(HeaderList.class)
                                .addBean(HeaderList.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class) && 
x.getAnnotation(RestBean.class).name().equals("defaultRequestHeaders"))
+                               .find(x -> isRestBeanMethod(x, 
"defaultRequestHeaders"))
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -2952,21 +3023,21 @@ public class RestContext extends Context {
 
                        // Replace with bean from bean store.
                        rootBeanStore
-                               .getBean(HeaderList.class, 
"RestContext.defaultResponseHeaders")
+                               .getBean(HeaderList.class, 
"defaultResponseHeaders")
                                .ifPresent(x -> v.get().impl(x));
 
-                       // Replace with builder from:  public [static] 
HeaderList.Builder createDefaultResponseHeaders(<args>)
+                       // Replace with builder from:  
@RestBean(name="defaultResponseHeaders") public [static] HeaderList.Builder 
xxx(<args>)
                        beanStore
                                .createMethodFinder(HeaderList.Builder.class)
                                .addBean(HeaderList.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class) && 
x.getAnnotation(RestBean.class).name().equals("defaultResponseHeaders"))
+                               .find(x -> isRestBeanMethod(x, 
"defaultResponseHeaders"))
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] HeaderList 
createDefaultResponseHeaders(<args>)
+                       // Replace with bean from:  
@RestBean(name="defaultResponseHeaders") public [static] HeaderList xxx(<args>)
                        beanStore
                                .createMethodFinder(HeaderList.class)
                                .addBean(HeaderList.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class) && 
x.getAnnotation(RestBean.class).name().equals("defaultResponseHeaders"))
+                               .find(x -> isRestBeanMethod(x, 
"defaultResponseHeaders"))
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -3080,21 +3151,21 @@ public class RestContext extends Context {
                        );
 
                        rootBeanStore
-                               .getBean(NamedAttributeList.class, 
"RestContext.defaultRequestAttributes")
+                               .getBean(NamedAttributeList.class, 
"defaultRequestAttributes")
                                .ifPresent(x -> v.get().impl(x));
 
-                       // Replace with bean from:  public [static] 
NamedAttributeList.Builder createDefaultRequestAttributes(<args>)
+                       // Replace with bean from:  
@RestBean(name="defaultRequestAttributes") public [static] 
NamedAttributeList.Builder xxx(<args>)
                        beanStore
                                
.createMethodFinder(NamedAttributeList.Builder.class)
                                .addBean(NamedAttributeList.Builder.class, 
v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class) && 
x.getAnnotation(RestBean.class).name().equals("defaultRequestAttributes"))
+                               .find(x -> isRestBeanMethod(x, 
"defaultRequestAttributes"))
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] 
NamedAttributeList createDefaultRequestAttributes(<args>)
+                       // Replace with bean from:  
@RestBean(name="defaultRequestAttributes") public [static] NamedAttributeList 
xxx(<args>)
                        beanStore
                                .createMethodFinder(NamedAttributeList.class)
                                .addBean(NamedAttributeList.Builder.class, 
v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class) && 
x.getAnnotation(RestBean.class).name().equals("defaultRequestAttributes"))
+                               .find(x -> isRestBeanMethod(x, 
"defaultRequestAttributes"))
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -3275,18 +3346,18 @@ public class RestContext extends Context {
                                .getBean(RestOpArgList.class)
                                .ifPresent(x -> v.get().impl(x));
 
-                       // Replace with builder from:  public [static] 
RestOpArgList.Builder createRestOpArgs(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] RestOpArgList.Builder xxx(<args>)
                        beanStore
                                .createMethodFinder(RestOpArgList.Builder.class)
                                .addBean(RestOpArgList.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] 
RestOpArgList createRestOpArgs(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
RestOpArgList xxx(<args>)
                        beanStore
                                .createMethodFinder(RestOpArgList.class)
                                .addBean(RestOpArgList.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -3371,10 +3442,10 @@ public class RestContext extends Context {
                                .getBean(DebugEnablement.class)
                                .ifPresent(x -> creator.impl(x));
 
-                       // Replace with bean from:  public [static] 
DebugEnablement createDebugEnablement(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
DebugEnablement xxx(<args>)
                        beanStore
                                .createMethodFinder(DebugEnablement.class)
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> creator.impl(x));
 
                        return creator;
@@ -3433,11 +3504,11 @@ public class RestContext extends Context {
                                getHookMethods(resource, HookEvent.START_CALL)
                        );
 
-                       // Replace with bean from:  public [static] MethodList 
createStartCallMethods(<args>)
+                       // Replace with bean from:  
@RestBean(name="startCallMethods") public [static] MethodList xxx(<args>)
                        beanStore
                                .createMethodFinder(MethodList.class)
                                .addBean(MethodList.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class) && 
x.getAnnotation(RestBean.class).name().equals("startCallMethods"))
+                               .find(x -> isRestBeanMethod(x, 
"startCallMethods"))
                                .run(x -> v.set(x));
 
                        return v.get();
@@ -3496,11 +3567,11 @@ public class RestContext extends Context {
                                getHookMethods(resource, HookEvent.END_CALL)
                        );
 
-                       // Replace with bean from:  public [static] MethodList 
createEndCallMethods(<args>)
+                       // Replace with bean from:  
@RestBean(name="endCallMethods") public [static] MethodList xxx(<args>)
                        beanStore
                                .createMethodFinder(MethodList.class)
                                .addBean(MethodList.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class) && 
x.getAnnotation(RestBean.class).name().equals("endCallMethods"))
+                               .find(x -> isRestBeanMethod(x, 
"endCallMethods"))
                                .run(x -> v.set(x));
 
                        return v.get();
@@ -3559,11 +3630,11 @@ public class RestContext extends Context {
                                getHookMethods(resource, HookEvent.POST_INIT)
                        );
 
-                       // Replace with bean from:  public [static] MethodList 
createPostInitMethods(<args>)
+                       // Replace with bean from:  
@RestBean(name="postInitMethods") public [static] MethodList xxx(<args>)
                        beanStore
                                .createMethodFinder(MethodList.class)
                                .addBean(MethodList.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class) && 
x.getAnnotation(RestBean.class).name().equals("postInitMethods"))
+                               .find(x -> isRestBeanMethod(x, 
"postInitMethods"))
                                .run(x -> v.set(x));
 
                        return v.get();
@@ -3622,11 +3693,11 @@ public class RestContext extends Context {
                                getHookMethods(resource, 
HookEvent.POST_INIT_CHILD_FIRST)
                        );
 
-                       // Replace with bean from:  public [static] MethodList 
createPostInitChildFirstMethods(<args>)
+                       // Replace with bean from:  
@RestBean(name="postInitChildFirstMethods") public [static] MethodList 
xxx(<args>)
                        beanStore
                                .createMethodFinder(MethodList.class)
                                .addBean(MethodList.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class) && 
x.getAnnotation(RestBean.class).name().equals("postInitChildFirstMethods"))
+                               .find(x -> isRestBeanMethod(x, 
"postInitChildFirstMethods"))
                                .run(x -> v.set(x));
 
                        return v.get();
@@ -3685,11 +3756,11 @@ public class RestContext extends Context {
                                getHookMethods(resource, HookEvent.DESTROY)
                        );
 
-                       // Replace with bean from:  public [static] MethodList 
createDestroyMethods(<args>)
+                       // Replace with bean from:  
@RestBean(name="destroyMethods") public [static] MethodList xxx(<args>)
                        beanStore
                                .createMethodFinder(MethodList.class)
                                .addBean(MethodList.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class) && 
x.getAnnotation(RestBean.class).name().equals("destroyMethods"))
+                               .find(x -> isRestBeanMethod(x, 
"destroyMethods"))
                                .run(x -> v.set(x));
 
                        return v.get();
@@ -3751,11 +3822,11 @@ public class RestContext extends Context {
                                getHookMethods(resource, HookEvent.PRE_CALL)
                        );
 
-                       // Replace with bean from:  public [static] MethodList 
createPreCallMethods(<args>)
+                       // Replace with bean from:  
@RestBean(name="preCallMethods") public [static] MethodList xxx(<args>)
                        beanStore
                                .createMethodFinder(MethodList.class)
                                .addBean(MethodList.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class) && 
x.getAnnotation(RestBean.class).name().equals("preCallMethods"))
+                               .find(x -> isRestBeanMethod(x, 
"preCallMethods"))
                                .run(x -> v.set(x));
 
                        return v.get();
@@ -3817,11 +3888,11 @@ public class RestContext extends Context {
                                getHookMethods(resource, HookEvent.POST_CALL)
                        );
 
-                       // Replace with bean from:  public [static] MethodList 
createPostCallMethods(<args>)
+                       // Replace with bean from:  
@RestBean(name="postCallMethods") public [static] MethodList xxx(<args>)
                        beanStore
                                .createMethodFinder(MethodList.class)
                                .addBean(MethodList.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class) && 
x.getAnnotation(RestBean.class).name().equals("postCallMethods"))
+                               .find(x -> isRestBeanMethod(x, 
"postCallMethods"))
                                .run(x -> v.set(x));
 
                        return v.get();
@@ -3936,18 +4007,18 @@ public class RestContext extends Context {
                                }
                        }
 
-                       // Replace with builder from:  public [static] 
RestOperations.Builder createRestOperations(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] RestOperations.Builder xxx(<args>)
                        beanStore
                                
.createMethodFinder(RestOperations.Builder.class)
                                .addBean(RestOperations.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] 
RestOperations createRestOperations(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
RestOperations xxx(<args>)
                        beanStore
                                .createMethodFinder(RestOperations.class)
                                .addBean(RestOperations.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -4036,18 +4107,18 @@ public class RestContext extends Context {
                                v.get().add(cc);
                        }
 
-                       // Replace with builder from:  public [static] 
RestChildren.Builder createRestChildren(<args>)
+                       // Replace with builder from:  @RestBean public 
[static] RestChildren.Builder xxx(<args>)
                        beanStore
                                .createMethodFinder(RestChildren.Builder.class)
                                .addBean(RestChildren.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.set(x));
 
-                       // Replace with bean from:  public [static] 
RestChildren createRestChildren(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
RestChildren xxx(<args>)
                        beanStore
                                .createMethodFinder(RestChildren.class)
                                .addBean(RestChildren.Builder.class, v.get())
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> v.get().impl(x));
 
                        return v.get();
@@ -4133,10 +4204,10 @@ public class RestContext extends Context {
                                .getBean(SwaggerProvider.class)
                                .ifPresent(x -> creator.impl(x));
 
-                       // Replace with bean from:  public [static] 
SwaggerProvider createSwaggerProvider(<args>)
+                       // Replace with bean from:  @RestBean public [static] 
SwaggerProvider xxx(<args>)
                        beanStore
                                .createMethodFinder(SwaggerProvider.class)
-                               .find(x -> x.hasAnnotation(RestBean.class))
+                               .find(Builder::isRestBeanMethod)
                                .run(x -> creator.impl(x));
 
                        return creator;
@@ -5541,6 +5612,16 @@ public class RestContext extends Context {
                        return x2;
                }
 
+               private static boolean isRestBeanMethod(MethodInfo mi) {
+                       RestBean x = mi.getAnnotation(RestBean.class);
+                       return x != null && x.methodScope().length == 0;
+               }
+
+               private static boolean isRestBeanMethod(MethodInfo mi, String 
name) {
+                       RestBean x = mi.getAnnotation(RestBean.class);
+                       return x != null && x.methodScope().length == 0 && 
x.name().equals(name);
+               }
+
                
//----------------------------------------------------------------------------------------------------
                // Methods inherited from ServletConfig
                
//----------------------------------------------------------------------------------------------------
@@ -5715,9 +5796,9 @@ public class RestContext extends Context {
                        jsonSchemaGenerator = bs.add(JsonSchemaGenerator.class, 
builder.jsonSchemaGenerator().build());
                        fileFinder = bs.add(FileFinder.class, 
builder.fileFinder().orElse(null));
                        staticFiles = bs.add(StaticFiles.class, 
builder.staticFiles().orElse(null));
-                       defaultRequestHeaders = bs.add(HeaderList.class, 
builder.defaultRequestHeaders().build(), "RestContext.defaultRequestHeaders");
-                       defaultResponseHeaders = bs.add(HeaderList.class, 
builder.defaultResponseHeaders().build(), "RestContext.defaultResponseHeaders");
-                       defaultRequestAttributes = 
bs.add(NamedAttributeList.class, builder.defaultRequestAttributes().build(), 
"RestContext.defaultRequestAttributes");
+                       defaultRequestHeaders = bs.add(HeaderList.class, 
builder.defaultRequestHeaders().build(), "defaultRequestHeaders");
+                       defaultResponseHeaders = bs.add(HeaderList.class, 
builder.defaultResponseHeaders().build(), "defaultResponseHeaders");
+                       defaultRequestAttributes = 
bs.add(NamedAttributeList.class, builder.defaultRequestAttributes().build(), 
"defaultRequestAttributes");
                        restOpArgs = builder.restOpArgs().build().asArray();
                        debugEnablement = bs.add(DebugEnablement.class, 
builder.debugEnablement().orElse(null));
                        startCallMethods = 
builder.startCallMethods().stream().map(this::toMethodInvoker).toArray(MethodInvoker[]::new);
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 d4072bce8..ef94a08d4 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
@@ -2171,9 +2171,9 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
                
//-----------------------------------------------------------------------------------------------------------------
 
                private boolean matches(MethodInfo annotated) {
-                       RestMethodBean a = 
annotated.getAnnotation(RestMethodBean.class);
+                       RestBean a = annotated.getAnnotation(RestBean.class);
                        if (a != null) {
-                               for (String n : a.method()) {
+                               for (String n : a.methodScope()) {
                                        if ("*".equals(n))
                                                return true;
                                        if (restMethod.getName().equals(n))
@@ -2184,11 +2184,11 @@ public class RestOpContext extends Context implements 
Comparable<RestOpContext>
                }
 
                private boolean matches(MethodInfo annotated, String beanName) {
-                       RestMethodBean a = 
annotated.getAnnotation(RestMethodBean.class);
+                       RestBean a = annotated.getAnnotation(RestBean.class);
                        if (a != null) {
                                if (! a.name().equals(beanName))
                                        return false;
-                               for (String n : a.method()) {
+                               for (String n : a.methodScope()) {
                                        if ("*".equals(n))
                                                return true;
                                        if (restMethod.getName().equals(n))
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestBean.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestBean.java
index 6fec8b199..620942abf 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestBean.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestBean.java
@@ -16,9 +16,106 @@ import static java.lang.annotation.ElementType.*;
 import static java.lang.annotation.RetentionPolicy.*;
 
 import java.lang.annotation.*;
+import java.util.logging.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.config.*;
+import org.apache.juneau.cp.*;
+import org.apache.juneau.encoders.*;
+import org.apache.juneau.http.header.*;
+import org.apache.juneau.http.part.*;
+import org.apache.juneau.httppart.*;
+import org.apache.juneau.jsonschema.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.rest.*;
+import org.apache.juneau.rest.arg.*;
+import org.apache.juneau.rest.converter.*;
+import org.apache.juneau.rest.debug.*;
+import org.apache.juneau.rest.guard.*;
+import org.apache.juneau.rest.httppart.*;
+import org.apache.juneau.rest.logger.*;
+import org.apache.juneau.rest.matcher.*;
+import org.apache.juneau.rest.processor.*;
+import org.apache.juneau.rest.staticfile.*;
+import org.apache.juneau.rest.stats.*;
+import org.apache.juneau.rest.swagger.*;
+import org.apache.juneau.rest.util.*;
+import org.apache.juneau.serializer.*;
+import org.apache.juneau.svl.*;
 
 /**
- * TODO
+ * Rest bean injection annotation.
+ *
+ * <p>
+ * Used on methods of {@link Rest}-annotated classes to denote methods that 
override and customize beans
+ * used by the REST framework.
+ *
+ * <h5 class='figure'>Example</h5>
+ * <p class='bcode'>
+ *     <ja>@Rest</ja>
+ *     <jk>public class</jk> MyRest <jk>extends</jk> BasicRestServlet 
<jk>implements</jk> BasicUniversalConfig {
+ *
+ *             <jc>// Use a customized call logger for the class.</jc>
+ *             <ja>@RestBean</ja>
+ *             <jk>public</jk> CallLogger myCallLogger() {
+ *                     <jk>return</jk> 
CallLogger.<jsm>create</jsm>().logger(<js>"mylogger"</js>).build();
+ *             }
+ *
+ *             <jc>// Set a default header on a specific REST method.</jc>
+ *             <jc>// Input parameter is the default header list builder with 
all annotations applied.</jc>
+ *             
<ja>@RestBean</ja>(name=<js>"defaultRequestHeaders"</js>,methodScope=<js>"myRestMethod"</js>)
+ *             <jk>public</jk> HeaderList.Builder 
myRequestHeaders(HeaderList.Builder <jv>builder</jv>) {
+ *                     <jk>return</jk> 
<jv>builder</jv>.set(ContentType.<jsf>TEXT_PLAIN</jsf>).build();
+ *             }
+ *     }
+ * </p>
+ *
+ * <ul>
+ *     <li>Methods must be public.
+ *     <li>Methods can be static or non-static.
+ *     <li>Any injectable beans (including spring beans) can be passed as 
arguments into the method.
+ *     <li>Bean names are required when multiple beans of the same type exist 
in the bean store.
+ *     <li>By default, the injected bean scope is class-level (applies to the 
entire class).  The
+ *             {@link RestBean#methodScope()} annotation can be used to apply 
to method-level only (when applicable).
+ * </ul>
+ *
+ * <p>
+ * Any of the following types can be customized via injection:
+ * <table class='w800 styled'>
+ *     <tr><th>Bean class</td><th>Bean qualifying names</th><th>Scope</th></tr>
+ *     <tr><td>{@link BeanContext}<br>{@link 
org.apache.juneau.BeanContext.Builder}</td><td></td><td>class<br>method</td></tr>
+ *     <tr><td>{@link BeanStore}<br>{@link 
org.apache.juneau.cp.BeanStore.Builder}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link CallLogger}<br>{@link 
org.apache.juneau.rest.logger.CallLogger.Builder}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link Config}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link DebugEnablement}<br>{@link 
org.apache.juneau.rest.debug.DebugEnablement.Builder}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link EncoderSet}<br>{@link 
org.apache.juneau.encoders.EncoderSet.Builder}</td><td></td><td>class<br>method</td></tr>
+ *     <tr><td>{@link FileFinder}<br>{@link 
org.apache.juneau.cp.FileFinder.Builder}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link HeaderList}<br>{@link 
org.apache.juneau.http.header.HeaderList.Builder}</td><td><js>"defaultRequestHeaders"</js><br><js>"defaultResponseHeaders"</js></td><td>class<br>method</td></tr>
+ *     <tr><td>{@link HttpPartParser}<br>{@link 
org.apache.juneau.httppart.HttpPartParser.Creator}</td><td></td><td>class<br>method</td></tr>
+ *     <tr><td>{@link HttpPartSerializer}<br>{@link 
org.apache.juneau.httppart.HttpPartSerializer.Creator}</td><td></td><td>class<br>method</td></tr>
+ *     <tr><td>{@link JsonSchemaGenerator}<br>{@link 
org.apache.juneau.jsonschema.JsonSchemaGenerator.Builder}</td><td></td><td>class<br>method</td></tr>
+ *     <tr><td>{@link Logger}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link Messages}<br>{@link 
org.apache.juneau.cp.Messages.Builder}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link MethodExecStore}<br>{@link 
org.apache.juneau.rest.stats.MethodExecStore.Builder}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link 
MethodList}</td><td><js>"destroyMethods"</js><br><js>"endCallMethods"</js><br><js>"postCallMethods"</js><br><js>"postInitChildFirstMethods"</js><br><js>"postInitMethods"</js><br><js>"preCallMethods"</js><br><js>"startCallMethods"</js></td><td>class</td></tr>
+ *     <tr><td>{@link NamedAttributeList}<br>{@link 
org.apache.juneau.rest.httppart.NamedAttributeList.Builder}</td><td><js>"defaultRequestAttributes"</js></td><td>class<br>method</td></tr>
+ *     <tr><td>{@link ParserSet}<br>{@link 
org.apache.juneau.parser.ParserSet.Builder}</td><td></td><td>class<br>method</td></tr>
+ *     <tr><td>{@link PartList}<br>{@link 
org.apache.juneau.http.part.PartList.Builder}</td><td><js>"defaultRequestQueryData"</js><br><js>"defaultRequestFormData"</js></td><td>method</td></tr>
+ *     <tr><td>{@link ResponseProcessorList}<br>{@link 
org.apache.juneau.rest.processor.ResponseProcessorList.Builder}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link RestChildren}<br>{@link 
org.apache.juneau.rest.RestChildren.Builder}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link RestConverterList}<br>{@link 
org.apache.juneau.rest.converter.RestConverterList.Builder}</td><td></td><td>method</td></tr>
+ *     <tr><td>{@link RestGuardList}<br>{@link 
org.apache.juneau.rest.guard.RestGuardList.Builder}</td><td></td><td>method</td></tr>
+ *     <tr><td>{@link RestMatcherList}<br>{@link 
org.apache.juneau.rest.matcher.RestMatcherList.Builder}</td><td></td><td>method</td></tr>
+ *     <tr><td>{@link RestOpArgList}<br>{@link 
org.apache.juneau.rest.arg.RestOpArgList.Builder}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link RestOperations}<br>{@link 
org.apache.juneau.rest.RestOperations.Builder}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link SerializerSet}<br>{@link 
org.apache.juneau.serializer.SerializerSet.Builder}</td><td></td><td>class<br>method</td></tr>
+ *     <tr><td>{@link StaticFiles}<br>{@link 
org.apache.juneau.rest.staticfile.StaticFiles.Builder}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link SwaggerProvider}<br>{@link 
org.apache.juneau.rest.swagger.SwaggerProvider.Builder}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link ThrownStore}<br>{@link 
org.apache.juneau.rest.stats.ThrownStore.Builder}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link UrlPathMatcherList}</td><td></td><td>method</td></tr>
+ *     <tr><td>{@link VarList}</td><td></td><td>class</td></tr>
+ *     <tr><td>{@link VarResolver}<br>{@link 
org.apache.juneau.svl.VarResolver.Builder}</td><td></td><td>class</td></tr>
+ * </table>
  */
 @Target({METHOD})
 @Retention(RUNTIME)
@@ -28,7 +125,24 @@ public @interface RestBean {
        /**
         * The bean name to use to distinguish beans of the same type for 
different purposes.
         *
-        * @return The bean name to use to distinguish beans of the same type 
for different purposes.
+        * <p>
+        * For example, there are two {@link HeaderList} beans:  
<js>"defaultRequestHeaders"</js> and <js>"defaultResponseHeaders"</js>.  This 
annotation
+        * would be used to differentiate between them.
+        *
+        * @return The bean name to use to distinguish beans of the same type 
for different purposes, or blank if bean type is unique.
         */
        String name() default "";
+
+       /**
+        * The short names of the methods that this annotation applies to.
+        *
+        * <p>
+        * Can use <js>"*"</js> to apply to all methods.
+        *
+        * <p>
+        * Ignored for class-level scope.
+        *
+        * @return The short names of the methods that this annotation applies 
to, or empty if class-scope.
+        */
+       String[] methodScope() default {};
 }
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethodBean.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethodBean.java
deleted file mode 100644
index fe9c505af..000000000
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethodBean.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// 
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
-// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
-// * with the License.  You may obtain a copy of the License at                
                                              *
-// *                                                                           
                                              *
-// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
-// *                                                                           
                                              *
-// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
-// * specific language governing permissions and limitations under the 
License.                                              *
-// 
***************************************************************************************************************************
-package org.apache.juneau.rest.annotation;
-
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
-
-import java.lang.annotation.*;
-
-/**
- * TODO
- */
-@Target({METHOD})
-@Retention(RUNTIME)
-@Inherited
-public @interface RestMethodBean {
-
-       /**
-        * The short names of the methods that this annotation applies to.
-        * 
-        * <p>
-        * Can use <js>"*"</js> to apply to all methods.
-        *
-        * @return The short names of the methods that this annotation applies 
to.
-        */
-       String[] method() default {};
-
-       /**
-        * The bean name to use to distinguish beans of the same type for 
different purposes.
-        *
-        * @return The bean name to use to distinguish beans of the same type 
for different purposes.
-        */
-       String name() default "";
-}

Reply via email to