From commits-return-5791-archive-asf-public=cust-asf.ponee.io@juneau.apache.org Sat Dec 8 14:56:32 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 67683180670 for ; Sat, 8 Dec 2018 14:56:31 +0100 (CET) Received: (qmail 82368 invoked by uid 500); 8 Dec 2018 13:56:30 -0000 Mailing-List: contact commits-help@juneau.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@juneau.apache.org Delivered-To: mailing list commits@juneau.apache.org Received: (qmail 82359 invoked by uid 99); 8 Dec 2018 13:56:30 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Dec 2018 13:56:30 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id D632C82F16; Sat, 8 Dec 2018 13:56:29 +0000 (UTC) Date: Sat, 08 Dec 2018 13:56:29 +0000 To: "commits@juneau.apache.org" Subject: [juneau] branch master updated: Spring Boot changes. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <154427738978.18753.2310772297626576745@gitbox.apache.org> From: jamesbognar@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: juneau X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: d99b46ec428f6c668539a753fca6914bf06a0c67 X-Git-Newrev: f4ae17d488196499037bceaec52af40abd519071 X-Git-Rev: f4ae17d488196499037bceaec52af40abd519071 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated 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 f4ae17d Spring Boot changes. f4ae17d is described below commit f4ae17d488196499037bceaec52af40abd519071 Author: JamesBognar AuthorDate: Sat Dec 8 08:56:15 2018 -0500 Spring Boot changes. --- .../utils/ClasspathResourceFinderSimple.java | 19 ++++- ...ver.html => 02.SpringRestResourceResolver.html} | 2 +- juneau-doc/src/main/javadoc/overview.html | 89 +++++++++++++++++++--- juneau-doc/src/main/javadoc/resources/docs.txt | 9 ++- .../main/javadoc/resources/fragments/about.html | 4 +- .../src/main/javadoc/resources/fragments/toc.html | 7 +- .../juneau/examples/rest/springboot/App.java | 23 +++--- ...Initializer.java => JuneauRestInitializer.java} | 10 +-- ...Processor.java => JuneauRestPostProcessor.java} | 64 +++++++++++----- .../{JuneauIntegration.java => JuneauRest.java} | 25 ++++-- 10 files changed, 182 insertions(+), 70 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinderSimple.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinderSimple.java index 410bfa4..3de00c5 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinderSimple.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/ClasspathResourceFinderSimple.java @@ -65,16 +65,29 @@ public class ClasspathResourceFinderSimple implements ClasspathResourceFinder { * @throws IOException */ protected InputStream findClasspathResource(Class baseClass, String name, Locale locale) throws IOException { - if (locale == null) - return baseClass.getResourceAsStream(name); + + if (locale == null) + return getResourceAsStream(baseClass, name); + for (String n : getCandidateFileNames(name, locale)) { - InputStream is = baseClass.getResourceAsStream(n); + InputStream is = getResourceAsStream(baseClass, n); if (is != null) return is; } return null; } + private InputStream getResourceAsStream(Class baseClass, String name) { + InputStream is = baseClass.getResourceAsStream(name); + if (is != null) + return is; + if (! name.startsWith("/")) + is = baseClass.getResourceAsStream("/" + name); + if (is != null) + return is; + return null; + } + /** * Returns the candidate file names for the specified file name in the specified locale. * diff --git a/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.SpringRestResourceResolver.html b/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/02.SpringRestResourceResolver.html similarity index 99% rename from juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.SpringRestResourceResolver.html rename to juneau-doc/docs/Topics/09.juneau-rest-server-springboot/02.SpringRestResourceResolver.html index 2105729..3ee50a2 100644 --- a/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.SpringRestResourceResolver.html +++ b/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/02.SpringRestResourceResolver.html @@ -16,7 +16,7 @@ {new} SpringRestResourceResolver

- The {@link oaj.rest.springboot.SpringRestResourceResolver} class + The {@link oaj.rest.springboot.SpringRestResourceResolver} class is an implementation of * Implementation of a {@link RestResourceResolver} for resolving resource classes using Spring. diff --git a/juneau-doc/src/main/javadoc/overview.html b/juneau-doc/src/main/javadoc/overview.html index 66688da..03d9cf0 100644 --- a/juneau-doc/src/main/javadoc/overview.html +++ b/juneau-doc/src/main/javadoc/overview.html @@ -359,9 +359,10 @@

  1. Juneau JAX-RS Provider

-
  • juneau-rest-server-springboot

    +
  • juneau-rest-server-springboot

      -
    1. TODO

      +
    2. Classes

      +
    3. SpringRestResourceResolver

  • juneau-rest-client

      @@ -454,7 +455,7 @@
    1. ConfigResource

    2. LogsResource

    -
  • juneau-examples-rest

    +
  • juneau-examples-rest-jetty

    1. Classes

    2. Deploying to Heroku

      @@ -21386,7 +21387,7 @@ -

      9 - juneau-rest-server-springboot

      +

      9 - juneau-rest-server-springboot

      Maven Dependency

      @@ -21404,22 +21405,88 @@

      OSGi Module

      - org.apache.juneau.rest.springboot_{@property juneauVersion}.jar + org.apache.juneau.rest.server.springboot_{@property juneauVersion}.jar

      - The juneau-rest-server-springboot library provides classes to make it easy to deploy Juneau - REST resources within the Spring Boot framework. + The juneau-rest-server-springboot library provides classes to make it easy to integrate + Juneau REST resources with Spring and Spring Boot.

      -

      9.1 - TODO

      -
      +

      9.1 - Classes

      +

      TODO

      -
      +
      + + + +

      9.2 - SpringRestResourceResolver

      +
      +

      + The {@link org.apache.juneau.rest.springboot.SpringRestResourceResolver} class + + + * Implementation of a {@link RestResourceResolver} for resolving resource classes using Spring. + * + *

      + * Used for resolving resource classes defined via {@link RestResource#children()}. + * + *

      + * A typical usage pattern for registering a Juneau REST resource class is shown below: + * + *

      + * @Configuration + * public class MySpringConfiguration { + * + * @AutoWired + * private static volatile ApplicationContext appContext; + * + * @Bean + * public RestResourceResolver restResourceResolver(ApplicationContext appContext) { + * return new SpringRestResourceResolver(appContext); + * } + * + * @Bean + * public RootRest root(RestResourceResolver resolver) { + * return new RootRest().setRestResourceResolver(resolver); + * } + * + * @Bean + * public ServletRegistrationBean rootRegistration(RootRest root) { + * return new ServletRegistrationBean(root, CONTEXT_ROOT, CONTEXT_ROOT+"/", CONTEXT_ROOT+"/*"); + * } + *

      + +

      +public class SpringRestResourceResolver extends BasicRestResourceResolver { + + private ApplicationContext applicationContext; + + /** + * Constructor. + * + * @param applicationContext The spring application context object. + */ + public SpringRestResourceResolver(ApplicationContext applicationContext) { + this.applicationContext = applicationContext; + } + + @Override /* RestResourceResolver */ + public T resolve(Object parent, Class c, RestContextBuilder builder, Object...args) { + T resource = null; + try { + resource = applicationContext.getBean(c); + } catch (Exception e) { /* Ignore */ } + if (resource == null) + resource = super.resolve(parent, c, builder); + return resource; + } +} +
      @@ -27232,7 +27299,7 @@ -

      16 - juneau-examples-rest

      +

      16 - juneau-examples-rest-jetty

      Archive File

      diff --git a/juneau-doc/src/main/javadoc/resources/docs.txt b/juneau-doc/src/main/javadoc/resources/docs.txt index 774753b..16fe6b2 100644 --- a/juneau-doc/src/main/javadoc/resources/docs.txt +++ b/juneau-doc/src/main/javadoc/resources/docs.txt @@ -91,9 +91,9 @@ juneau-dto.Swagger = #juneau-dto.Swagger, Overview > juneau-dto > Swagger juneau-dto.SwaggerUI = #juneau-dto.SwaggerUI, Overview > juneau-dto > Swagger UI juneau-examples-core = #juneau-examples-core, Overview > juneau-examples-core juneau-examples-rest = #juneau-examples-rest, Overview > juneau-examples-rest -juneau-examples-rest-jetty = #juneau-examples-rest-jetty, Overview > juneau-examples-rest -juneau-examples-rest-jetty.Classes = #juneau-examples-rest-jetty.Classes, Overview > juneau-examples-rest > Classes -juneau-examples-rest-jetty.DeployingToHeroku = #juneau-examples-rest-jetty.DeployingToHeroku, Overview > juneau-examples-rest > Deploying to Heroku +juneau-examples-rest-jetty = #juneau-examples-rest-jetty, Overview > juneau-examples-rest-jetty +juneau-examples-rest-jetty.Classes = #juneau-examples-rest-jetty.Classes, Overview > juneau-examples-rest-jetty > Classes +juneau-examples-rest-jetty.DeployingToHeroku = #juneau-examples-rest-jetty.DeployingToHeroku, Overview > juneau-examples-rest-jetty > Deploying to Heroku juneau-examples-rest-springboot = #juneau-examples-rest-springboot, Overview > juneau-examples-rest-springboot juneau-examples-rest-springboot.Classes = #juneau-examples-rest-springboot.Classes, Overview > juneau-examples-rest-springboot > Classes juneau-examples-rest-springboot.DeployingToHeroku = #juneau-examples-rest-springboot.DeployingToHeroku, Overview > juneau-examples-rest-springboot > Deploying to Heroku @@ -255,7 +255,8 @@ juneau-rest-server = #juneau-rest-server, Overview > juneau-rest-server juneau-rest-server-jaxrs = #juneau-rest-server-jaxrs, Overview > juneau-rest-server-jaxrs juneau-rest-server-jaxrs.BaseProvider = #juneau-rest-server-jaxrs.BaseProvider, Overview > juneau-rest-server-jaxrs > Juneau JAX-RS Provider juneau-rest-server-springboot = #juneau-rest-server-springboot, Overview > juneau-rest-server-springboot -juneau-rest-server-springboot.TODO = #juneau-rest-server-springboot.TODO, Overview > juneau-rest-server-springboot > TODO +juneau-rest-server-springboot.Classes = #juneau-rest-server-springboot.Classes, Overview > juneau-rest-server-springboot > Classes +juneau-rest-server-springboot.SpringRestResourceResolver = #juneau-rest-server-springboot.SpringRestResourceResolver, Overview > juneau-rest-server-springboot > SpringRestResourceResolver juneau-rest-server.BuiltInParameters = #juneau-rest-server.BuiltInParameters, Overview > juneau-rest-server > Built-in Parameters juneau-rest-server.ClassHierarchy = #juneau-rest-server.ClassHierarchy, Overview > juneau-rest-server > Class Hierarchy juneau-rest-server.ClientVersioning = #juneau-rest-server.ClientVersioning, Overview > juneau-rest-server > Client Versioning diff --git a/juneau-doc/src/main/javadoc/resources/fragments/about.html b/juneau-doc/src/main/javadoc/resources/fragments/about.html index bc8175c..abed929 100644 --- a/juneau-doc/src/main/javadoc/resources/fragments/about.html +++ b/juneau-doc/src/main/javadoc/resources/fragments/about.html @@ -21,9 +21,9 @@

    3. juneau-svl
      A simple yet powerful variable replacement language API.
    4. juneau-config
      A sophisticated configuration file API.
    5. juneau-rest-server
      A universal REST server API for creating Swagger-based self-documenting REST interfaces using POJOs, simply deployed as - one or more top-level servlets in any Servlet 3.1.0+ container. + one or more top-level servlets in any Servlet 3.1.0+ container or Spring Boot.
    6. juneau-rest-client
      A universal REST client API for interacting with Juneau or 3rd-party REST interfaces using POJOs and proxy interfaces. -
    7. juneau-microservice
      A REST microservice API that combines all the features above with a simple configurable Jetty server for +
    8. juneau-microservice
      A REST microservice API that combines all the features above as a simple configurable Jetty server for creating lightweight standalone REST interfaces that start up in milliseconds.

      diff --git a/juneau-doc/src/main/javadoc/resources/fragments/toc.html b/juneau-doc/src/main/javadoc/resources/fragments/toc.html index 99f1c20..0543a58 100644 --- a/juneau-doc/src/main/javadoc/resources/fragments/toc.html +++ b/juneau-doc/src/main/javadoc/resources/fragments/toc.html @@ -302,9 +302,10 @@

      1. Juneau JAX-RS Provider

      -
    9. juneau-rest-server-springboot

      +
    10. juneau-rest-server-springboot

        -
      1. TODO

        +
      2. Classes

        +
      3. SpringRestResourceResolver

    11. juneau-rest-client

        @@ -397,7 +398,7 @@
      1. ConfigResource

      2. LogsResource

      -
    12. juneau-examples-rest

      +
    13. juneau-examples-rest-jetty

      1. Classes

      2. Deploying to Heroku

        diff --git a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java b/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java index df887a8..f6f8781 100644 --- a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java +++ b/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java @@ -17,32 +17,27 @@ import org.apache.juneau.rest.springboot.*; import org.apache.juneau.rest.springboot.annotations.*; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.*; -import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.annotation.*; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RestController; /** * Entry point for Examples REST application when deployed as a Spring Boot application. */ @SpringBootApplication -@JuneauIntegration(rootResources = RootResources.class) @Controller -@RestController public class App { - private static volatile ConfigurableApplicationContext ctx; - public static void main(String[] args) { - ctx = new SpringApplicationBuilder(App.class) - .initializers(new JuneauContextInitializer(App.class)) + new SpringApplicationBuilder(App.class) + .initializers(new JuneauRestInitializer(App.class)) .run(args); } - public static void start() { - main(new String[0]); - } - - public static void stop() { - ctx.stop(); + /** + * Our root resource. + */ + @Bean @JuneauRest + public RootResources getRootResources() { + return new RootResources(); } } diff --git a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauContextInitializer.java b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauRestInitializer.java similarity index 84% rename from juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauContextInitializer.java rename to juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauRestInitializer.java index 985b273..e7ac5c3 100644 --- a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauContextInitializer.java +++ b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauRestInitializer.java @@ -12,7 +12,7 @@ // *************************************************************************************************************************** package org.apache.juneau.rest.springboot; -import org.apache.juneau.rest.springboot.annotations.JuneauIntegration; +import org.apache.juneau.rest.springboot.annotations.JuneauRest; import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; @@ -20,10 +20,10 @@ import org.springframework.context.ConfigurableApplicationContext; * Spring Boot context initializer for Juneau REST resources. * *

        - * Looks for the {@link JuneauIntegration} annotation on the Spring application class to automatically + * Looks for the {@link JuneauRest} annotation on the Spring application class to automatically * register Juneau REST resources. */ -public class JuneauContextInitializer implements ApplicationContextInitializer { +public class JuneauRestInitializer implements ApplicationContextInitializer { private final Class appClass; @@ -32,14 +32,14 @@ public class JuneauContextInitializer implements ApplicationContextInitializer appClass) { + public JuneauRestInitializer(Class appClass) { this.appClass = appClass; } @Override /* ApplicationContextInitializer */ public void initialize(ConfigurableApplicationContext ctx) { ctx.addBeanFactoryPostProcessor( - new JuneauIntegrationPostProcessor(ctx, appClass) + new JuneauRestPostProcessor(ctx, appClass) ); } } \ No newline at end of file diff --git a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauIntegrationPostProcessor.java b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauRestPostProcessor.java similarity index 59% rename from juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauIntegrationPostProcessor.java rename to juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauRestPostProcessor.java index 0caa24c..8a19fca 100644 --- a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauIntegrationPostProcessor.java +++ b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauRestPostProcessor.java @@ -13,24 +13,28 @@ package org.apache.juneau.rest.springboot; import org.apache.juneau.rest.*; -import org.apache.juneau.rest.springboot.annotations.JuneauIntegration; +import org.apache.juneau.rest.springboot.annotations.JuneauRest; import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.beans.factory.config.*; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.*; +import org.springframework.core.type.*; + +import java.util.*; import javax.servlet.Servlet; /** - * Processes the {@link JuneauIntegration} annotation on the Spring application class. + * Processes the {@link JuneauRest} annotation on the Spring application class and @Bean methods. */ -public class JuneauIntegrationPostProcessor implements BeanDefinitionRegistryPostProcessor { +public class JuneauRestPostProcessor implements BeanDefinitionRegistryPostProcessor { - private final ConfigurableApplicationContext ctx; private final Class appClass; + private final RestResourceResolver restResourceResolver; + private BeanDefinitionRegistry registry; /** * Constructor. @@ -38,34 +42,52 @@ public class JuneauIntegrationPostProcessor implements BeanDefinitionRegistryPos * @param ctx The spring application context. * @param appClass The spring application class. */ - public JuneauIntegrationPostProcessor(ConfigurableApplicationContext ctx, Class appClass) { + public JuneauRestPostProcessor(ConfigurableApplicationContext ctx, Class appClass) { this.appClass = appClass; - this.ctx = ctx; + this.restResourceResolver = new SpringRestResourceResolver(ctx); } @Override /* BeanDefinitionRegistryPostProcessor */ public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) { + this.registry = registry; + } - JuneauIntegration a = appClass.getAnnotation(JuneauIntegration.class); + @Override /* BeanDefinitionRegistryPostProcessor */ + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { + try { + Map m = new LinkedHashMap<>(); - if (a == null || a.rootResources().length == 0) - return; + // @JuneauRest on App class. + if (appClass != null) { + JuneauRest a = appClass.getAnnotation(JuneauRest.class); + if (a != null) + for (Class c : a.servlets()) + m.put(c.getName(), c.newInstance()); + } - RestResourceResolver rrr = new SpringRestResourceResolver(ctx); + // @JuneauRest on classes. + for (Map.Entry e : beanFactory.getBeansWithAnnotation(JuneauRest.class).entrySet()) + if (e.getValue() instanceof RestServlet) + m.put(e.getKey(), (RestServlet)e.getValue()); - for (Class c : a.rootResources()) { - try { - RestServlet rs = c.newInstance().setRestResourceResolver(rrr); + // @JuneauRest on @Bean method. + for (String beanName : beanFactory.getBeanNamesForType(RestServlet.class)) { + BeanDefinition bd = beanFactory.getBeanDefinition(beanName); + if (bd.getSource() instanceof AnnotatedTypeMetadata) { + AnnotatedTypeMetadata metadata = (AnnotatedTypeMetadata)bd.getSource(); + if (metadata.isAnnotated(JuneauRest.class.getName())) + m.put(beanName, (RestServlet)beanFactory.getBean(beanName)); + } + } + + for (RestServlet rs : m.values()) { + rs.setRestResourceResolver(restResourceResolver); ServletRegistrationBean reg = new ServletRegistrationBean<>(rs, '/' + rs.getPath()); registry.registerBeanDefinition(reg.getServletName(), new RootBeanDefinition(ServletRegistrationBean.class, () -> reg)); - } catch (Exception e) { - throw new RuntimeException(e); } - } - } - @Override /* BeanDefinitionRegistryPostProcessor */ - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { - // No-op + } catch (Exception e) { + throw new RuntimeException(e); + } } } diff --git a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/JuneauIntegration.java b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/JuneauRest.java similarity index 75% rename from juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/JuneauIntegration.java rename to juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/JuneauRest.java index b6deacd..64718a6 100644 --- a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/JuneauIntegration.java +++ b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/JuneauRest.java @@ -12,23 +12,36 @@ // *************************************************************************************************************************** package org.apache.juneau.rest.springboot.annotations; +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.*; + import org.apache.juneau.rest.RestServlet; -import org.springframework.stereotype.Component; +import org.springframework.context.annotation.*; import java.lang.annotation.*; /** * Added to Spring application classes to denote Juneau REST resource classes to deploy as servlets. + * + *

        + * The annotation can be used in two places: + *

          + *
        • + * On the source class of a Spring Boot application. + *
        • + * On {@link Bean}-annotated methods on configuration beans. + *
        */ -@Target({ElementType.TYPE}) -@Retention(RetentionPolicy.RUNTIME) +@Target({TYPE,METHOD}) +@Retention(RUNTIME) @Documented @Inherited -@Component -public @interface JuneauIntegration { +public @interface JuneauRest { /** * Specifies one or more implementations of {@link RestServlet} to deploy as servlets. + *

        + * This method is only applicable when used on the source class of a Spring Boot application. */ - Class[] rootResources(); + Class[] servlets() default {}; }