You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2018/12/08 14:51:42 UTC
[juneau] branch master updated: Javadocs
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 4c68ad5 Javadocs
4c68ad5 is described below
commit 4c68ad5cae8e7c7ca727f9919602344eeba2714b
Author: JamesBognar <ja...@apache.org>
AuthorDate: Sat Dec 8 09:51:28 2018 -0500
Javadocs
---
.../01.Classes.html | 20 ----
.../01.Overview.html | 75 ++++++++++++
.../02.SpringRestResourceResolver.html | 77 ------------
juneau-doc/src/main/javadoc/overview.html | 129 +++++++++------------
juneau-doc/src/main/javadoc/resources/docs.txt | 3 +-
.../src/main/javadoc/resources/fragments/toc.html | 3 +-
.../juneau/examples/rest/springboot/App.java | 2 +-
.../rest/springboot/JuneauRestInitializer.java | 33 +++---
.../rest/springboot/JuneauRestPostProcessor.java | 76 ++++++------
.../{annotations => annotation}/JuneauRest.java | 2 +-
.../{annotations => annotation}/package-info.java | 2 +-
11 files changed, 190 insertions(+), 232 deletions(-)
diff --git a/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.Classes.html b/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.Classes.html
deleted file mode 100644
index eb288a4..0000000
--- a/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.Classes.html
+++ /dev/null
@@ -1,20 +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.
- ***************************************************************************************************************************/
- -->
-
-{new} Classes
-
-<p>
- TODO
-</p>
diff --git a/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.Overview.html b/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.Overview.html
new file mode 100644
index 0000000..9902594
--- /dev/null
+++ b/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/01.Overview.html
@@ -0,0 +1,75 @@
+<!--
+/***************************************************************************************************************************
+ * 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.
+ ***************************************************************************************************************************/
+ -->
+
+{new} Overview
+
+<p>
+ The Juneau integration component for Spring Boot consists of the following classes:
+</p>
+<ul class='doctree'>
+ <li class='ja'>{@link oajr.springboot.annotation.JuneauRest}
+ <li class='jc'>{@link oajr.springboot.JuneauRestInitializer}
+ <li class='jc'>{@link oajr.springboot.SpringRestResourceResolver}
+</ul>
+<p>
+ A typical Spring Boot application can use the {@link oajr.springboot.JuneauRestInitializer} to find
+ and register Juneau REST servlets via the {@link oajr.springboot.annotation.JuneauRest} annotation.
+</p>
+<h5 class='figure'>Example:</h5>
+<p class='bpcode w800'>
+ <ja>@SpringBootApplication</ja>
+ <ja>@Controller</ja>
+ <jk>public class</jk> App {
+
+ <jk>public static void</jk> main(String[] args) {
+ <jk>new</jk> SpringApplicationBuilder(App.<jk>class</jk>)
+ .initializers(<jk>new</jk> JuneauRestInitializer(App.<jk>class</jk>))
+ .run(args);
+ }
+
+ <jd>/** Our root resource */</jd>
+ <ja>@Bean @JuneauRest</ja>
+ <jk>public</jk> RootResource getRootResource() {
+ <jk>return new</jk> RootResource(); <jc>// A subclass of RestServlet.</jc>
+ }
+ }
+</p>
+<p>
+ The initializer will search for Spring beans annotated with the <ja>@JuneauRest</ja> annotation identifying it
+ as a top-level servlet to be deployed in the Spring Boot web container.
+</p>
+<p>
+ Another option is to use the <ja>@JuneauRest</ja> annotation on your Spring Boot source class like so:
+</p>
+<p class='bpcode w800'>
+ <ja>@SpringBootApplication</ja>
+ <ja>@Controller</ja>
+ <ja>@JuneauRest</ja>(servlets=RootResource.<jk>class</jk>)
+ <jk>public class</jk> App {
+
+ <jk>public static void</jk> main(String[] args) {
+ <jk>new</jk> SpringApplicationBuilder(App.<jk>class</jk>)
+ .initializers(<jk>new</jk> JuneauRestInitializer(App.<jk>class</jk>))
+ .run(args);
+ }
+ }
+</p>
+<p>
+ The root servlets are given an instance of {@link oajr.springboot.SpringRestResourceResolver} which allows
+ for child resources to be defined as injectable Spring beans.
+</p>
+
+
+
diff --git a/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/02.SpringRestResourceResolver.html b/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/02.SpringRestResourceResolver.html
deleted file mode 100644
index 3ee50a2..0000000
--- a/juneau-doc/docs/Topics/09.juneau-rest-server-springboot/02.SpringRestResourceResolver.html
+++ /dev/null
@@ -1,77 +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.
- ***************************************************************************************************************************/
- -->
-
-{new} SpringRestResourceResolver
-
-<p>
- The {@link oaj.rest.springboot.SpringRestResourceResolver} class is an implementation of
-
-
- * Implementation of a {@link RestResourceResolver} for resolving resource classes using Spring.
- *
- * <p>
- * Used for resolving resource classes defined via {@link RestResource#children()}.
- *
- * <p>
- * A typical usage pattern for registering a Juneau REST resource class is shown below:
- *
- * <p class='bpcode w800'>
- * <ja>@Configuration</ja>
- * <jk>public class</jk> MySpringConfiguration {
- *
- * <ja>@AutoWired</ja>
- * <jk>private static volatile</jk> ApplicationContext <jsf>appContext</jsf>;
- *
- * <ja>@Bean</ja>
- * <jk>public</jk> RestResourceResolver restResourceResolver(ApplicationContext appContext) {
- * <jk>return new</jk> SpringRestResourceResolver(appContext);
- * }
- *
- * <ja>@Bean</ja>
- * <jk>public</jk> RootRest root(RestResourceResolver resolver) {
- * <jk>return new</jk> RootRest().setRestResourceResolver(resolver);
- * }
- *
- * <ja>@Bean</ja>
- * <jk>public</jk> ServletRegistrationBean rootRegistration(RootRest root) {
- * <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;
-
- /**
- * Constructor.
- *
- * @param applicationContext The spring application context object.
- */
- public SpringRestResourceResolver(ApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
- }
-
- @Override /* RestResourceResolver */
- public <T> T resolve(Object parent, Class<T> 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;
- }
-}
diff --git a/juneau-doc/src/main/javadoc/overview.html b/juneau-doc/src/main/javadoc/overview.html
index 03d9cf0..6c67a66 100644
--- a/juneau-doc/src/main/javadoc/overview.html
+++ b/juneau-doc/src/main/javadoc/overview.html
@@ -361,8 +361,7 @@
</ol>
<li><p class='toc2 new'><a class='doclink' href='#juneau-rest-server-springboot'>juneau-rest-server-springboot</a></p>
<ol>
- <li><p class='new'><a class='doclink' href='#juneau-rest-server-springboot.Classes'>Classes</a></p>
- <li><p class='new'><a class='doclink' href='#juneau-rest-server-springboot.SpringRestResourceResolver'>SpringRestResourceResolver</a></p>
+ <li><p class='new'><a class='doclink' href='#juneau-rest-server-springboot.Overview'>Overview</a></p>
</ol>
<li><p class='toc2 '><a class='doclink' href='#juneau-rest-client'>juneau-rest-client</a></p>
<ol>
@@ -21415,78 +21414,64 @@
<!-- ==================================================================================================== -->
-<h3 class='topic new' onclick='toggle(this)'><a href='#juneau-rest-server-springboot.Classes' id='juneau-rest-server-springboot.Classes'>9.1 - Classes</a></h3>
-<div class='topic'><!-- START: 9.1 - juneau-rest-server-springboot.Classes -->
+<h3 class='topic new' onclick='toggle(this)'><a href='#juneau-rest-server-springboot.Overview' id='juneau-rest-server-springboot.Overview'>9.1 - Overview</a></h3>
+<div class='topic'><!-- START: 9.1 - juneau-rest-server-springboot.Overview -->
<p>
- TODO
+ The Juneau integration component for Spring Boot consists of the following classes:
</p>
-</div><!-- END: 9.1 - juneau-rest-server-springboot.Classes -->
-
-<!-- ==================================================================================================== -->
-
-<h3 class='topic new' onclick='toggle(this)'><a href='#juneau-rest-server-springboot.SpringRestResourceResolver' id='juneau-rest-server-springboot.SpringRestResourceResolver'>9.2 - SpringRestResourceResolver</a></h3>
-<div class='topic'><!-- START: 9.2 - juneau-rest-server-springboot.SpringRestResourceResolver -->
-<p>
- The {@link org.apache.juneau.rest.springboot.SpringRestResourceResolver} class
-
-
- * Implementation of a {@link RestResourceResolver} for resolving resource classes using Spring.
- *
- * <p>
- * Used for resolving resource classes defined via {@link RestResource#children()}.
- *
- * <p>
- * A typical usage pattern for registering a Juneau REST resource class is shown below:
- *
- * <p class='bpcode w800'>
- * <ja>@Configuration</ja>
- * <jk>public class</jk> MySpringConfiguration {
- *
- * <ja>@AutoWired</ja>
- * <jk>private static volatile</jk> ApplicationContext <jsf>appContext</jsf>;
- *
- * <ja>@Bean</ja>
- * <jk>public</jk> RestResourceResolver restResourceResolver(ApplicationContext appContext) {
- * <jk>return new</jk> SpringRestResourceResolver(appContext);
- * }
- *
- * <ja>@Bean</ja>
- * <jk>public</jk> RootRest root(RestResourceResolver resolver) {
- * <jk>return new</jk> RootRest().setRestResourceResolver(resolver);
- * }
- *
- * <ja>@Bean</ja>
- * <jk>public</jk> ServletRegistrationBean rootRegistration(RootRest root) {
- * <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;
-
- /**
- * Constructor.
- *
- * @param applicationContext The spring application context object.
- */
- public SpringRestResourceResolver(ApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
- }
-
- @Override /* RestResourceResolver */
- public <T> T resolve(Object parent, Class<T> 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;
- }
-}
-</div><!-- END: 9.2 - juneau-rest-server-springboot.SpringRestResourceResolver -->
+<ul class='doctree'>
+ <li class='ja'>{@link org.apache.juneau.rest.springboot.annotation.JuneauRest}
+ <li class='jc'>{@link org.apache.juneau.rest.springboot.JuneauRestInitializer}
+ <li class='jc'>{@link org.apache.juneau.rest.springboot.SpringRestResourceResolver}
+</ul>
+<p>
+ A typical Spring Boot application can use the {@link org.apache.juneau.rest.springboot.JuneauRestInitializer} to find
+ and register Juneau REST servlets using the {@link org.apache.juneau.rest.springboot.annotation.JuneauRest} annotation.
+</p>
+<h5 class='figure'>Example:</h5>
+<p class='bpcode w800'>
+ <ja>@SpringBootApplication</ja>
+ <ja>@Controller</ja>
+ <jk>public class</jk> App {
+
+ <jk>public static void</jk> main(String[] args) {
+ <jk>new</jk> SpringApplicationBuilder(App.<jk>class</jk>)
+ .initializers(<jk>new</jk> JuneauRestInitializer(App.<jk>class</jk>))
+ .run(args);
+ }
+
+ <jd>/** Our root resource */</jd>
+ <ja>@Bean @JuneauRest</ja>
+ <jk>public</jk> RootResource getRootResource() {
+ <jk>return new</jk> RootResource(); <jc>// A subclass of RestServlet.</jc>
+ }
+ }
+</p>
+<p>
+ The initializer will search for Spring beans annotated with the <ja>@JuneauRest</ja> annotation identifying it
+ as a top-level servlet to be deployed in the Spring Boot web container.
+</p>
+<p>
+ Another option is to use the <ja>@JuneauRest</ja> annotation on your Spring Boot source class like so:
+</p>
+<p class='bpcode w800'>
+ <ja>@SpringBootApplication</ja>
+ <ja>@Controller</ja>
+ <ja>@JuneauRest</ja>(servlets=RootResource.<jk>class</jk>)
+ <jk>public class</jk> App {
+
+ <jk>public static void</jk> main(String[] args) {
+ <jk>new</jk> SpringApplicationBuilder(App.<jk>class</jk>)
+ .initializers(<jk>new</jk> JuneauRestInitializer(App.<jk>class</jk>))
+ .run(args);
+ }
+ }
+</p>
+<p>
+ The root servlets are given an instance of {@link org.apache.juneau.rest.springboot.SpringRestResourceResolver} which allows
+ for child resources to be defined as injectable Spring beans.
+</p>
+</div><!-- END: 9.1 - juneau-rest-server-springboot.Overview -->
</div><!-- END: 9 - juneau-rest-server-springboot -->
<!-- ==================================================================================================== -->
diff --git a/juneau-doc/src/main/javadoc/resources/docs.txt b/juneau-doc/src/main/javadoc/resources/docs.txt
index 16fe6b2..56fbc6c 100644
--- a/juneau-doc/src/main/javadoc/resources/docs.txt
+++ b/juneau-doc/src/main/javadoc/resources/docs.txt
@@ -255,8 +255,7 @@ 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.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-springboot.Overview = #juneau-rest-server-springboot.Overview, Overview > juneau-rest-server-springboot > Overview
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/toc.html b/juneau-doc/src/main/javadoc/resources/fragments/toc.html
index 0543a58..553d727 100644
--- a/juneau-doc/src/main/javadoc/resources/fragments/toc.html
+++ b/juneau-doc/src/main/javadoc/resources/fragments/toc.html
@@ -304,8 +304,7 @@
</ol>
<li><p class='toc2 new'><a class='doclink' href='{OVERVIEW_URL}#juneau-rest-server-springboot'>juneau-rest-server-springboot</a></p>
<ol>
- <li><p class='new'><a class='doclink' href='{OVERVIEW_URL}#juneau-rest-server-springboot.Classes'>Classes</a></p>
- <li><p class='new'><a class='doclink' href='{OVERVIEW_URL}#juneau-rest-server-springboot.SpringRestResourceResolver'>SpringRestResourceResolver</a></p>
+ <li><p class='new'><a class='doclink' href='{OVERVIEW_URL}#juneau-rest-server-springboot.Overview'>Overview</a></p>
</ol>
<li><p class='toc2 '><a class='doclink' href='{OVERVIEW_URL}#juneau-rest-client'>juneau-rest-client</a></p>
<ol>
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 f6f8781..9f3f602 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
@@ -14,7 +14,7 @@ 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.apache.juneau.rest.springboot.annotation.*;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.*;
import org.springframework.context.annotation.*;
diff --git a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauRestInitializer.java b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauRestInitializer.java
index e7ac5c3..5cdd6cf 100644
--- a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauRestInitializer.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.JuneauRest;
+import org.apache.juneau.rest.springboot.annotation.*;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
@@ -20,26 +20,23 @@ import org.springframework.context.ConfigurableApplicationContext;
* Spring Boot context initializer for Juneau REST resources.
*
* <p>
- * Looks for the {@link JuneauRest} annotation on the Spring application class to automatically
- * register Juneau REST resources.
+ * Looks for the {@link JuneauRest} annotation on the Spring application class to automatically register Juneau REST resources.
*/
public class JuneauRestInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
- private final Class<?> appClass;
+ private final Class<?> appClass;
- /**
- * Constructor.
- *
- * @param appClass The Spring application class.
- */
- public JuneauRestInitializer(Class<?> appClass) {
- this.appClass = appClass;
- }
+ /**
+ * Constructor.
+ *
+ * @param appClass The Spring application class.
+ */
+ public JuneauRestInitializer(Class<?> appClass) {
+ this.appClass = appClass;
+ }
- @Override /* ApplicationContextInitializer */
- public void initialize(ConfigurableApplicationContext ctx) {
- ctx.addBeanFactoryPostProcessor(
- new JuneauRestPostProcessor(ctx, appClass)
- );
- }
+ @Override /* ApplicationContextInitializer */
+ public void initialize(ConfigurableApplicationContext ctx) {
+ ctx.addBeanFactoryPostProcessor(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/JuneauRestPostProcessor.java b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauRestPostProcessor.java
index 8a19fca..0070ee7 100644
--- a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauRestPostProcessor.java
+++ b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauRestPostProcessor.java
@@ -13,7 +13,7 @@
package org.apache.juneau.rest.springboot;
import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.springboot.annotations.JuneauRest;
+import org.apache.juneau.rest.springboot.annotation.*;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.*;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
@@ -32,62 +32,62 @@ import javax.servlet.Servlet;
*/
public class JuneauRestPostProcessor implements BeanDefinitionRegistryPostProcessor {
- private final Class<?> appClass;
- private final RestResourceResolver restResourceResolver;
- private BeanDefinitionRegistry registry;
+ private final Class<?> appClass;
+ private final RestResourceResolver restResourceResolver;
+ private BeanDefinitionRegistry registry;
- /**
- * Constructor.
- *
- * @param ctx The spring application context.
- * @param appClass The spring application class.
- */
- public JuneauRestPostProcessor(ConfigurableApplicationContext ctx, Class<?> appClass) {
- this.appClass = appClass;
- this.restResourceResolver = new SpringRestResourceResolver(ctx);
- }
+ /**
+ * Constructor.
+ *
+ * @param ctx The spring application context.
+ * @param appClass The spring application class.
+ */
+ public JuneauRestPostProcessor(ConfigurableApplicationContext ctx, Class<?> appClass) {
+ this.appClass = appClass;
+ this.restResourceResolver = new SpringRestResourceResolver(ctx);
+ }
- @Override /* BeanDefinitionRegistryPostProcessor */
- public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
- this.registry = registry;
- }
+ @Override /* BeanDefinitionRegistryPostProcessor */
+ public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
+ this.registry = registry;
+ }
- @Override /* BeanDefinitionRegistryPostProcessor */
- public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
- try {
+ @Override /* BeanDefinitionRegistryPostProcessor */
+ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
+ try {
Map<String,RestServlet> m = new LinkedHashMap<>();
- // @JuneauRest on App class.
- if (appClass != null) {
- JuneauRest a = appClass.getAnnotation(JuneauRest.class);
- if (a != null)
- for (Class<? extends RestServlet> c : a.servlets())
- m.put(c.getName(), c.newInstance());
- }
+ // @JuneauRest on App class.
+ if (appClass != null) {
+ JuneauRest a = appClass.getAnnotation(JuneauRest.class);
+ if (a != null)
+ for (Class<? extends RestServlet> c : a.servlets())
+ m.put(c.getName(), c.newInstance());
+ }
- // @JuneauRest on classes.
+ // @JuneauRest on classes.
for (Map.Entry<String,Object> e : beanFactory.getBeansWithAnnotation(JuneauRest.class).entrySet())
if (e.getValue() instanceof RestServlet)
- m.put(e.getKey(), (RestServlet)e.getValue());
+ m.put(e.getKey(), (RestServlet) e.getValue());
// @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));
- }
+ 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<Servlet> reg = new ServletRegistrationBean<>(rs, '/' + rs.getPath());
- registry.registerBeanDefinition(reg.getServletName(), new RootBeanDefinition(ServletRegistrationBean.class, () -> reg));
+ ServletRegistrationBean<Servlet> reg = new ServletRegistrationBean<>(rs, '/' + rs.getPath());
+ registry.registerBeanDefinition(reg.getServletName(), new RootBeanDefinition(ServletRegistrationBean.class, () -> reg));
}
} 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/JuneauRest.java b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotation/JuneauRest.java
similarity index 97%
rename from juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/JuneauRest.java
rename to juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotation/JuneauRest.java
index 64718a6..775de44 100644
--- a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/JuneauRest.java
+++ b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotation/JuneauRest.java
@@ -10,7 +10,7 @@
// * "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;
+package org.apache.juneau.rest.springboot.annotation;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
diff --git a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/package-info.java b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotation/package-info.java
similarity index 95%
rename from juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/package-info.java
rename to juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotation/package-info.java
index 4644116..e90e56d 100755
--- a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotations/package-info.java
+++ b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/annotation/package-info.java
@@ -14,5 +14,5 @@
/**
* Spring Boot Integration Annotations
*/
-package org.apache.juneau.rest.springboot.annotations;
+package org.apache.juneau.rest.springboot.annotation;