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 d99b46e  Spring Boot integration changes.
d99b46e is described below

commit d99b46ec428f6c668539a753fca6914bf06a0c67
Author: JamesBognar <[email protected]>
AuthorDate: Fri Dec 7 14:23:04 2018 -0500

    Spring Boot integration changes.
---
 juneau-doc/docs/Fragments/about.html               |   4 +-
 .../Topics/09.juneau-rest-server-springboot.html   |   8 +--
 .../{01.TODO.html => 01.Classes.html}              |   2 +-
 .../01.SpringRestResourceResolver.html             |  41 ++++++------
 .../docs/Topics/16.juneau-examples-rest-jetty.html |   2 +-
 .../juneau-examples-rest-springboot.launch         |   5 +-
 .../rest/springboot/{AppStart.java => App.java}    |  44 +++++--------
 .../main/resources}/files/htdocs/images/asf.png    | Bin
 .../main/resources}/files/htdocs/images/juneau.png | Bin
 .../resources}/files/htdocs/styles/SwaggerUI.css   |   0
 .../main/resources}/files/htdocs/themes/dark.css   |   0
 .../main/resources}/files/htdocs/themes/devops.css |   0
 .../main/resources}/files/htdocs/themes/light.css  |   0
 .../resources}/files/htdocs/themes/original.css    |   0
 .../main/resources/juneau.cfg}                     |   0
 .../microservice/jetty/resources/package-info.java |  45 +++++--------
 ...tializer.java => JuneauContextInitializer.java} |  28 ++++++--
 ...on.java => JuneauIntegrationPostProcessor.java} |  73 ++++++++++-----------
 .../springboot/SpringRestResourceResolver.java     |  12 ++--
 ...neauIntegration.java => JuneauIntegration.java} |  11 +++-
 ...ledJuneauIntegration.java => package-info.java} |  45 +++++--------
 ...ledJuneauIntegration.java => package-info.java} |  45 +++++--------
 22 files changed, 173 insertions(+), 192 deletions(-)

diff --git a/juneau-doc/docs/Fragments/about.html 
b/juneau-doc/docs/Fragments/about.html
index bc8175c..abed929 100644
--- a/juneau-doc/docs/Fragments/about.html
+++ b/juneau-doc/docs/Fragments/about.html
@@ -21,9 +21,9 @@
        <li><b>juneau-svl</b><br>A simple yet powerful variable replacement 
language API.
        <li><b>juneau-config</b><br>A sophisticated configuration file API.
        <li><b>juneau-rest-server</b><br>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.
        <li><b>juneau-rest-client</b><br>A universal REST client API for 
interacting with Juneau or 3rd-party REST interfaces using POJOs and proxy 
interfaces.
-       <li><b>juneau-microservice</b><br>A REST microservice API that combines 
all the features above with a simple configurable Jetty server for 
+       <li><b>juneau-microservice</b><br>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.
 </ul>
 <p>
diff --git a/juneau-doc/docs/Topics/09.juneau-rest-server-springboot.html 
b/juneau-doc/docs/Topics/09.juneau-rest-server-springboot.html
index f098172..eb8774a 100644
--- a/juneau-doc/docs/Topics/09.juneau-rest-server-springboot.html
+++ b/juneau-doc/docs/Topics/09.juneau-rest-server-springboot.html
@@ -13,7 +13,7 @@
  
***************************************************************************************************************************/
  -->
 
-{todo} juneau-rest-server-springboot
+{new} juneau-rest-server-springboot
 
 <h5 class='figure'>Maven Dependency</h5>
 <p class='bpcode w500'>
@@ -31,10 +31,10 @@
 
 <h5 class='figure'>OSGi Module</h5>
 <p class='bpcode w500'>
-       org.apache.juneau.rest.springboot_{@property juneauVersion}.jar 
+       org.apache.juneau.rest.server.springboot_{@property juneauVersion}.jar 
 </p>   
 
 <p>
-       The <code>juneau-rest-server-springboot</code> library provides classes 
to make it easy to deploy Juneau
-       REST resources within the Spring Boot framework.
+       The <code>juneau-rest-server-springboot</code> library provides classes 
to make it easy to integrate
+       Juneau REST resources with Spring and Spring Boot.
 </p>
diff --git 
a/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.TODO.html 
b/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.Classes.html
similarity index 98%
rename from juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.TODO.html
rename to 
juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.Classes.html
index d2b8e42..eb288a4 100644
--- a/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.TODO.html
+++ b/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.Classes.html
@@ -13,7 +13,7 @@
  
***************************************************************************************************************************/
  -->
 
-{todo} TODO
+{new} Classes
 
 <p>
        TODO
diff --git 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/SpringRestResourceResolver.java
 
b/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.SpringRestResourceResolver.html
similarity index 50%
copy from 
juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/SpringRestResourceResolver.java
copy to 
juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.SpringRestResourceResolver.html
index b33fa86..2105729 100644
--- 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/SpringRestResourceResolver.java
+++ 
b/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.SpringRestResourceResolver.html
@@ -1,22 +1,24 @@
-// 
***************************************************************************************************************************
-// * 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.springboot;
+<!--
+/***************************************************************************************************************************
+ * 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.
+ 
***************************************************************************************************************************/
+ -->
 
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-import org.springframework.context.ApplicationContext;
+{new} SpringRestResourceResolver
 
-/**
+<p>
+       The {@link oaj.rest.springboot.SpringRestResourceResolver} class 
+       
+       
  * Implementation of a {@link RestResourceResolver} for resolving resource 
classes using Spring.
  *
  * <p>
@@ -39,7 +41,7 @@ import org.springframework.context.ApplicationContext;
  *
  *             <ja>@Bean</ja>
  *             <jk>public</jk> RootRest root(RestResourceResolver resolver) {
- *                     <jk>return new</jk> RootRest(resolver);
+ *                     <jk>return new</jk> 
RootRest().setRestResourceResolver(resolver);
  *             }
  *
  *             <ja>@Bean</ja>
@@ -47,7 +49,8 @@ import org.springframework.context.ApplicationContext;
  *                     <jk>return new</jk> ServletRegistrationBean(root, 
<jsf>CONTEXT_ROOT</jsf>, <jsf>CONTEXT_ROOT</jsf>+<js>"/"</js>, 
<jsf>CONTEXT_ROOT</jsf>+<js>"/*"</js>);
  *             }
  * </p>
- */
+       
+</p>
 public class SpringRestResourceResolver extends BasicRestResourceResolver {
 
        private ApplicationContext applicationContext;
diff --git a/juneau-doc/docs/Topics/16.juneau-examples-rest-jetty.html 
b/juneau-doc/docs/Topics/16.juneau-examples-rest-jetty.html
index 55b23f5..c22a110 100644
--- a/juneau-doc/docs/Topics/16.juneau-examples-rest-jetty.html
+++ b/juneau-doc/docs/Topics/16.juneau-examples-rest-jetty.html
@@ -13,7 +13,7 @@
  
***************************************************************************************************************************/
  -->
 
-{todo} juneau-examples-rest
+{todo} juneau-examples-rest-jetty
 
 <h5 class='figure'>Archive File</h5>
 <p class='bpcode w500'>
diff --git 
a/juneau-examples/juneau-examples-rest-springboot/juneau-examples-rest-springboot.launch
 
b/juneau-examples/juneau-examples-rest-springboot/juneau-examples-rest-springboot.launch
index 5d901f2..a193a4a 100644
--- 
a/juneau-examples/juneau-examples-rest-springboot/juneau-examples-rest-springboot.launch
+++ 
b/juneau-examples/juneau-examples-rest-springboot/juneau-examples-rest-springboot.launch
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry 
value="/juneau-microservice-server/src/main/java/org/apache/juneau/examples/rest/springboot/AppStart.java"/>
+<listEntry 
value="/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java"/>
 </listAttribute>
 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
 <listEntry value="1"/>
@@ -11,8 +11,7 @@
 <booleanAttribute 
key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
 <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" 
value="org.eclipse.m2e.launchconfig.classpathProvider"/>
 <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" 
value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" 
value="org.apache.juneau.examples.rest.springboot.AppStart"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" 
value="examples.cfg"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" 
value="org.apache.juneau.examples.rest.springboot.App"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" 
value="juneau-examples-rest-springboot"/>
 <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" 
value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
 </launchConfiguration>
diff --git 
a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/AppStart.java
 
b/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java
similarity index 68%
rename from 
juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/AppStart.java
rename to 
juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java
index 073ad07..df887a8 100644
--- 
a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/AppStart.java
+++ 
b/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java
@@ -13,48 +13,36 @@
 package org.apache.juneau.examples.rest.springboot;
 
 import org.apache.juneau.examples.rest.RootResources;
+import org.apache.juneau.rest.springboot.*;
 import org.apache.juneau.rest.springboot.annotations.*;
-import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.*;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 /**
  * Entry point for Examples REST application when deployed as a Spring Boot 
application.
  */
 @SpringBootApplication
-@EnabledJuneauIntegration(rootResources = RootResources.class)
+@JuneauIntegration(rootResources = RootResources.class)
 @Controller
 @RestController
-public class AppStart {
+public class App {
 
-    public static int counter = 0;
-    private static volatile ConfigurableApplicationContext context;
+       private static volatile ConfigurableApplicationContext ctx;
 
-    @GetMapping(value = "/status")
-    public String status() {
-        return "ok";
-    }
+       public static void main(String[] args) {
+               ctx = new SpringApplicationBuilder(App.class)
+                       .initializers(new JuneauContextInitializer(App.class))
+                       .run(args);
+       }
 
-    public static void main(String[] args) {
-        if (System.getProperty("juneau.configFile") == null)
-            System.setProperty("juneau.configFile", "examples.cfg");
-        try {
-            context = SpringApplication.run(AppStart.class, args);
-            if (context == null)
-                System.exit(2); // Probably port in use?
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
+       public static void start() {
+               main(new String[0]);
+       }
 
-    public static void start() {
-        main(new String[0]);
-    }
-
-    public static void stop() {
-        context.stop();
-    }
+       public static void stop() {
+               ctx.stop();
+       }
 }
diff --git 
a/juneau-examples/juneau-examples-rest-springboot/files/htdocs/images/asf.png 
b/juneau-examples/juneau-examples-rest-springboot/src/main/resources/files/htdocs/images/asf.png
similarity index 100%
rename from 
juneau-examples/juneau-examples-rest-springboot/files/htdocs/images/asf.png
rename to 
juneau-examples/juneau-examples-rest-springboot/src/main/resources/files/htdocs/images/asf.png
diff --git 
a/juneau-examples/juneau-examples-rest-springboot/files/htdocs/images/juneau.png
 
b/juneau-examples/juneau-examples-rest-springboot/src/main/resources/files/htdocs/images/juneau.png
similarity index 100%
rename from 
juneau-examples/juneau-examples-rest-springboot/files/htdocs/images/juneau.png
rename to 
juneau-examples/juneau-examples-rest-springboot/src/main/resources/files/htdocs/images/juneau.png
diff --git 
a/juneau-examples/juneau-examples-rest-springboot/files/htdocs/styles/SwaggerUI.css
 
b/juneau-examples/juneau-examples-rest-springboot/src/main/resources/files/htdocs/styles/SwaggerUI.css
similarity index 100%
rename from 
juneau-examples/juneau-examples-rest-springboot/files/htdocs/styles/SwaggerUI.css
rename to 
juneau-examples/juneau-examples-rest-springboot/src/main/resources/files/htdocs/styles/SwaggerUI.css
diff --git 
a/juneau-examples/juneau-examples-rest-springboot/files/htdocs/themes/dark.css 
b/juneau-examples/juneau-examples-rest-springboot/src/main/resources/files/htdocs/themes/dark.css
similarity index 100%
rename from 
juneau-examples/juneau-examples-rest-springboot/files/htdocs/themes/dark.css
rename to 
juneau-examples/juneau-examples-rest-springboot/src/main/resources/files/htdocs/themes/dark.css
diff --git 
a/juneau-examples/juneau-examples-rest-springboot/files/htdocs/themes/devops.css
 
b/juneau-examples/juneau-examples-rest-springboot/src/main/resources/files/htdocs/themes/devops.css
similarity index 100%
rename from 
juneau-examples/juneau-examples-rest-springboot/files/htdocs/themes/devops.css
rename to 
juneau-examples/juneau-examples-rest-springboot/src/main/resources/files/htdocs/themes/devops.css
diff --git 
a/juneau-examples/juneau-examples-rest-springboot/files/htdocs/themes/light.css 
b/juneau-examples/juneau-examples-rest-springboot/src/main/resources/files/htdocs/themes/light.css
similarity index 100%
rename from 
juneau-examples/juneau-examples-rest-springboot/files/htdocs/themes/light.css
rename to 
juneau-examples/juneau-examples-rest-springboot/src/main/resources/files/htdocs/themes/light.css
diff --git 
a/juneau-examples/juneau-examples-rest-springboot/files/htdocs/themes/original.css
 
b/juneau-examples/juneau-examples-rest-springboot/src/main/resources/files/htdocs/themes/original.css
similarity index 100%
rename from 
juneau-examples/juneau-examples-rest-springboot/files/htdocs/themes/original.css
rename to 
juneau-examples/juneau-examples-rest-springboot/src/main/resources/files/htdocs/themes/original.css
diff --git a/juneau-examples/juneau-examples-rest-springboot/examples.cfg 
b/juneau-examples/juneau-examples-rest-springboot/src/main/resources/juneau.cfg
similarity index 100%
rename from juneau-examples/juneau-examples-rest-springboot/examples.cfg
rename to 
juneau-examples/juneau-examples-rest-springboot/src/main/resources/juneau.cfg
diff --git 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/EnabledJuneauIntegration.java
 
b/juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/resources/package-info.java
old mode 100644
new mode 100755
similarity index 80%
copy from 
juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/EnabledJuneauIntegration.java
copy to 
juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/resources/package-info.java
index fb910ec..ff851bc
--- 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/EnabledJuneauIntegration.java
+++ 
b/juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/resources/package-info.java
@@ -1,27 +1,18 @@
-// 
***************************************************************************************************************************
-// * 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.springboot.annotations;
-
-import org.apache.juneau.rest.RestServlet;
-import org.springframework.stereotype.Component;
-
-import java.lang.annotation.*;
-
-@Target({ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-@Inherited
-@Component
-public @interface EnabledJuneauIntegration {
-    Class<? extends RestServlet>[] rootResources();
-}
+// 
***************************************************************************************************************************
+// * 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.                                              *
+// 
***************************************************************************************************************************
+
+/**
+ * Predefined Jetty Microservice Resources
+ */
+package org.apache.juneau.microservice.jetty.resources;
+
diff --git 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauApplicationContextInitializer.java
 
b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauContextInitializer.java
similarity index 68%
rename from 
juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauApplicationContextInitializer.java
rename to 
juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauContextInitializer.java
index 132e930..985b273 100644
--- 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauApplicationContextInitializer.java
+++ 
b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauContextInitializer.java
@@ -12,20 +12,34 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.rest.springboot;
 
-import org.apache.juneau.rest.springboot.annotations.EnabledJuneauIntegration;
+import org.apache.juneau.rest.springboot.annotations.JuneauIntegration;
 import org.springframework.context.ApplicationContextInitializer;
 import org.springframework.context.ConfigurableApplicationContext;
 
-public class JuneauApplicationContextInitializer implements 
ApplicationContextInitializer<ConfigurableApplicationContext> {
+/**
+ * Spring Boot context initializer for Juneau REST resources.
+ *
+ * <p>
+ * Looks for the {@link JuneauIntegration} annotation on the Spring 
application class to automatically
+ * register Juneau REST resources.
+ */
+public class JuneauContextInitializer implements 
ApplicationContextInitializer<ConfigurableApplicationContext> {
 
-    private Class appClass;
+    private final Class<?> appClass;
 
-    public JuneauApplicationContextInitializer(Class appClass) {
+    /**
+     * Constructor.
+     *
+     * @param appClass The Spring application class.
+     */
+    public JuneauContextInitializer(Class<?> appClass) {
         this.appClass = appClass;
     }
 
-    @Override
-    public void initialize(ConfigurableApplicationContext applicationContext) {
-        applicationContext.addBeanFactoryPostProcessor(new 
ServletConfiguration((EnabledJuneauIntegration) 
appClass.getAnnotation(EnabledJuneauIntegration.class)));
+    @Override /* ApplicationContextInitializer */
+    public void initialize(ConfigurableApplicationContext ctx) {
+       ctx.addBeanFactoryPostProcessor(
+               new JuneauIntegrationPostProcessor(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/ServletConfiguration.java
 
b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauIntegrationPostProcessor.java
similarity index 59%
rename from 
juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/ServletConfiguration.java
rename to 
juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauIntegrationPostProcessor.java
index b486bd8..0caa24c 100644
--- 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/ServletConfiguration.java
+++ 
b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauIntegrationPostProcessor.java
@@ -12,63 +12,60 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.rest.springboot;
 
-import org.apache.juneau.rest.RestServlet;
-import org.apache.juneau.rest.annotation.RestResource;
-import org.apache.juneau.rest.springboot.annotations.EnabledJuneauIntegration;
+import org.apache.juneau.rest.*;
+import org.apache.juneau.rest.springboot.annotations.JuneauIntegration;
 import org.springframework.beans.BeansException;
 import 
org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 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 javax.servlet.Servlet;
 
-public class ServletConfiguration implements 
BeanDefinitionRegistryPostProcessor {
-
-    private EnabledJuneauIntegration annotation = null;
-
-    public ServletConfiguration(EnabledJuneauIntegration annotation) {
-        this.annotation = annotation;
+/**
+ * Processes the {@link JuneauIntegration} annotation on the Spring 
application class.
+ */
+public class JuneauIntegrationPostProcessor implements 
BeanDefinitionRegistryPostProcessor {
+
+    private final ConfigurableApplicationContext ctx;
+    private final Class<?> appClass;
+
+    /**
+     * Constructor.
+     *
+     * @param ctx The spring application context.
+     * @param appClass The spring application class.
+     */
+    public JuneauIntegrationPostProcessor(ConfigurableApplicationContext ctx, 
Class<?> appClass) {
+        this.appClass = appClass;
+        this.ctx = ctx;
     }
 
-    @Override
+    @Override /* BeanDefinitionRegistryPostProcessor */
     public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry 
registry) {
 
-        if (annotation.rootResources() == null) {
-            return;
-        }
-
-        for (Class clazz : annotation.rootResources()) {
+       JuneauIntegration a = appClass.getAnnotation(JuneauIntegration.class);
 
-            RestServlet restServlet = createServlet(clazz);
-            RestResource restResource = 
restServlet.getClass().getAnnotation(RestResource.class);
-            registerServlet(registry, restServlet, restResource);
-        }
+       if (a == null || a.rootResources().length == 0)
+               return;
 
-    }
+       RestResourceResolver rrr = new SpringRestResourceResolver(ctx);
 
-    private void registerServlet(BeanDefinitionRegistry registry, Servlet 
restServlet, RestResource restResource) {
-        ServletRegistrationBean registration = new 
ServletRegistrationBean(restServlet, restResource.path());
-        registry.registerBeanDefinition(registration.getServletName(), new 
RootBeanDefinition(ServletRegistrationBean.class,
-                () -> registration));
-
-    }
-
-    private RestServlet createServlet(Class clazz) {
-        try {
-            return (RestServlet) clazz.newInstance();
-        } catch (InstantiationException e) {
-            e.printStackTrace();
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
+       for (Class<? extends RestServlet> c : a.rootResources()) {
+                       try {
+                   RestServlet rs = 
c.newInstance().setRestResourceResolver(rrr);
+                       ServletRegistrationBean<Servlet> reg = new 
ServletRegistrationBean<>(rs, '/' + rs.getPath());
+                       registry.registerBeanDefinition(reg.getServletName(), 
new RootBeanDefinition(ServletRegistrationBean.class, () -> reg));
+                       } catch (Exception e) {
+                               throw new RuntimeException(e);
+                       }
         }
-
-        return null;
     }
 
-    @Override
+    @Override /* BeanDefinitionRegistryPostProcessor */
     public void postProcessBeanFactory(ConfigurableListableBeanFactory 
beanFactory) throws BeansException {
-
+       // No-op
     }
 }
diff --git 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/SpringRestResourceResolver.java
 
b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/SpringRestResourceResolver.java
index b33fa86..bfae641 100644
--- 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/SpringRestResourceResolver.java
+++ 
b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/SpringRestResourceResolver.java
@@ -39,7 +39,7 @@ import org.springframework.context.ApplicationContext;
  *
  *             <ja>@Bean</ja>
  *             <jk>public</jk> RootRest root(RestResourceResolver resolver) {
- *                     <jk>return new</jk> RootRest(resolver);
+ *                     <jk>return new</jk> 
RootRest().setRestResourceResolver(resolver);
  *             }
  *
  *             <ja>@Bean</ja>
@@ -50,22 +50,22 @@ import org.springframework.context.ApplicationContext;
  */
 public class SpringRestResourceResolver extends BasicRestResourceResolver {
 
-       private ApplicationContext applicationContext;
+       private ApplicationContext ctx;
 
        /**
         * Constructor.
         *
-        * @param applicationContext The spring application context object.
+        * @param ctx The spring application context object.
         */
-       public SpringRestResourceResolver(ApplicationContext 
applicationContext) {
-               this.applicationContext = applicationContext;
+       public SpringRestResourceResolver(ApplicationContext ctx) {
+               this.ctx = ctx;
        }
 
        @Override /* RestResourceResolver */
        public <T> T resolve(Object parent, Class<T> c, RestContextBuilder 
builder, Object...args) {
                T resource = null;
                try {
-                       resource = applicationContext.getBean(c);
+                       resource = ctx.getBean(c);
                } catch (Exception e) { /* Ignore */ }
                if (resource == null)
                        resource = super.resolve(parent, c, builder);
diff --git 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/EnabledJuneauIntegration.java
 
b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/JuneauIntegration.java
similarity index 85%
copy from 
juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/EnabledJuneauIntegration.java
copy to 
juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/JuneauIntegration.java
index fb910ec..b6deacd 100644
--- 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/EnabledJuneauIntegration.java
+++ 
b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/JuneauIntegration.java
@@ -17,11 +17,18 @@ import org.springframework.stereotype.Component;
 
 import java.lang.annotation.*;
 
+/**
+ * Added to Spring application classes to denote Juneau REST resource classes 
to deploy as servlets.
+ */
 @Target({ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
 @Inherited
 @Component
-public @interface EnabledJuneauIntegration {
-    Class<? extends RestServlet>[] rootResources();
+public @interface JuneauIntegration {
+
+       /**
+        * Specifies one or more implementations of {@link RestServlet} to 
deploy as servlets.
+        */
+       Class<? extends RestServlet>[] rootResources();
 }
diff --git 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/EnabledJuneauIntegration.java
 
b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/package-info.java
old mode 100644
new mode 100755
similarity index 83%
copy from 
juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/EnabledJuneauIntegration.java
copy to 
juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/package-info.java
index fb910ec..4644116
--- 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/EnabledJuneauIntegration.java
+++ 
b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/package-info.java
@@ -1,27 +1,18 @@
-// 
***************************************************************************************************************************
-// * 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.springboot.annotations;
-
-import org.apache.juneau.rest.RestServlet;
-import org.springframework.stereotype.Component;
-
-import java.lang.annotation.*;
-
-@Target({ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-@Inherited
-@Component
-public @interface EnabledJuneauIntegration {
-    Class<? extends RestServlet>[] rootResources();
-}
+// 
***************************************************************************************************************************
+// * 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.                                              *
+// 
***************************************************************************************************************************
+
+/**
+ * Spring Boot Integration Annotations
+ */
+package org.apache.juneau.rest.springboot.annotations;
+
diff --git 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/EnabledJuneauIntegration.java
 
b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/package-info.java
old mode 100644
new mode 100755
similarity index 80%
rename from 
juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/EnabledJuneauIntegration.java
rename to 
juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/package-info.java
index fb910ec..93ebe26
--- 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/EnabledJuneauIntegration.java
+++ 
b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/package-info.java
@@ -1,27 +1,18 @@
-// 
***************************************************************************************************************************
-// * 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.springboot.annotations;
-
-import org.apache.juneau.rest.RestServlet;
-import org.springframework.stereotype.Component;
-
-import java.lang.annotation.*;
-
-@Target({ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-@Inherited
-@Component
-public @interface EnabledJuneauIntegration {
-    Class<? extends RestServlet>[] rootResources();
-}
+// 
***************************************************************************************************************************
+// * 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.                                              *
+// 
***************************************************************************************************************************
+
+/**
+ * Spring Boot Integration
+ */
+package org.apache.juneau.rest.springboot;
+

Reply via email to