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 6af640c REST refactoring.
6af640c is described below
commit 6af640ceba232bdfb87b2728694021b5b6632e18
Author: JamesBognar <[email protected]>
AuthorDate: Sun Jan 10 12:27:15 2021 -0500
REST refactoring.
---
.../org/apache/juneau/BasicResourceResolver.java | 31 ----
.../src/main/java/org/apache/juneau/Context.java | 78 ----------
.../org/apache/juneau/FuzzyResourceResolver.java | 31 ----
.../main/java/org/apache/juneau/PropertyStore.java | 157 ---------------------
.../java/org/apache/juneau/ResourceResolver.java | 47 ------
.../rest/springboot/JuneauRestInitializer.java | 54 -------
.../rest/springboot/JuneauRestPostProcessor.java | 94 ------------
.../springboot/SpringRestResourceResolver.java | 75 ----------
.../juneau/rest/BasicRestResourceResolver.java | 46 ------
.../apache/juneau/rest/RestResourceResolver.java | 74 ----------
10 files changed, 687 deletions(-)
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BasicResourceResolver.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BasicResourceResolver.java
deleted file mode 100644
index 65be819..0000000
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BasicResourceResolver.java
+++ /dev/null
@@ -1,31 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau;
-
-import static org.apache.juneau.internal.ClassUtils.*;
-
-/**
- * Basic implementation of a resource resolver.
- */
-@Deprecated
-public class BasicResourceResolver implements ResourceResolver {
-
- @Override /* ResourceResolver */
- public <T> T resolve(Object parent, Class<T> c, Object...args) {
- try {
- return castOrCreateFromOuter(parent, c, c, false, args);
- } catch (Exception e) {
- throw new BeanRuntimeException(e, c, "Could not
instantiate resource class");
- }
- }
-}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
index f363e0e..e5fcb75 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
@@ -716,47 +716,6 @@ public abstract class Context {
* @param def
* The default value if the property doesn't exist.
* <br>Can either be an instance of <c>T</c>, or a
<code>Class<? <jk>extends</jk> T></code>.
- * @param resolver
- * The resolver to use for instantiating objects.
- * @param args
- * Arguments to pass to the constructor.
- * Constructors matching the arguments are always used before
no-arg constructors.
- * @return A new property instance.
- */
- @Deprecated
- public <T> T getInstanceProperty(String key, Class<T> type, Object def,
ResourceResolver resolver, Object...args) {
- return propertyStore.getInstanceProperty(key, type, def,
resolver, args);
- }
-
- /**
- * Returns an instance of the specified class, string, or object
property.
- *
- * @param key The property name.
- * @param outer The outer object if the class we're instantiating is an
inner class.
- * @param type The class type of the property.
- * @param def
- * The default value if the property doesn't exist.
- * <br>Can either be an instance of <c>T</c>, or a
<code>Class<? <jk>extends</jk> T></code>.
- * @param resolver
- * The resolver to use for instantiating objects.
- * @param args
- * Arguments to pass to the constructor.
- * Constructors matching the arguments are always used before
no-arg constructors.
- * @return A new property instance.
- */
- @Deprecated
- public <T> T getInstanceProperty(String key, Object outer, Class<T>
type, Object def, ResourceResolver resolver, Object...args) {
- return propertyStore.getInstanceProperty(key, outer, type, def,
resolver, args);
- }
-
- /**
- * Returns an instance of the specified class, string, or object
property.
- *
- * @param key The property name.
- * @param type The class type of the property.
- * @param def
- * The default value if the property doesn't exist.
- * <br>Can either be an instance of <c>T</c>, or a
<code>Class<? <jk>extends</jk> T></code>.
* @param beanFactory The bean factory to use to instantiate beans.
* @return A new property instance.
*/
@@ -794,43 +753,6 @@ public abstract class Context {
* @param key The property name.
* @param type The class type of the property.
* @param def The default object to return if the property doesn't
exist.
- * @param resolver
- * The resolver to use for instantiating objects.
- * @param args
- * Arguments to pass to the constructor.
- * Constructors matching the arguments are always used before
no-arg constructors.
- * @return A new property instance.
- */
- @Deprecated
- public <T> T[] getInstanceArrayProperty(String key, Class<T> type, T[]
def, ResourceResolver resolver, Object...args) {
- return propertyStore.getInstanceArrayProperty(key, type, def,
resolver, args);
- }
-
- /**
- * Returns the specified property as an array of instantiated objects.
- *
- * @param key The property name.
- * @param outer The outer object if the class we're instantiating is an
inner class.
- * @param type The class type of the property.
- * @param def The default object to return if the property doesn't
exist.
- * @param resolver
- * The resolver to use for instantiating objects.
- * @param args
- * Arguments to pass to the constructor.
- * Constructors matching the arguments are always used before
no-arg constructors.
- * @return A new property instance.
- */
- @Deprecated
- public <T> T[] getInstanceArrayProperty(String key, Object outer,
Class<T> type, T[] def, ResourceResolver resolver, Object...args) {
- return propertyStore.getInstanceArrayProperty(key, outer, type,
def, resolver, args);
- }
-
- /**
- * Returns the specified property as an array of instantiated objects.
- *
- * @param key The property name.
- * @param type The class type of the property.
- * @param def The default object to return if the property doesn't
exist.
* @param beanFactory The bean factory to use for instantiating beans.
* @return A new property instance.
*/
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/FuzzyResourceResolver.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/FuzzyResourceResolver.java
deleted file mode 100644
index 74907ba..0000000
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/FuzzyResourceResolver.java
+++ /dev/null
@@ -1,31 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau;
-
-import static org.apache.juneau.internal.ClassUtils.*;
-
-/**
- * Basic implementation of a resource resolver.
- */
-@Deprecated
-public class FuzzyResourceResolver implements ResourceResolver {
-
- @Override /* ResourceResolver */
- public <T> T resolve(Object parent, Class<T> c, Object...args) {
- try {
- return castOrCreateFromOuter(parent, c, c, true, args);
- } catch (Exception e) {
- throw new BeanRuntimeException(e, c, "Could not
instantiate resource class");
- }
- }
-}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java
index b4e7d54..90dc81a 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java
@@ -530,57 +530,6 @@ public final class PropertyStore {
* @param def
* The default value if the property doesn't exist.
* <br>Can either be an instance of <c>T</c>, or a
<code>Class<? <jk>extends</jk> T></code>.
- * @param resolver
- * The resolver to use for instantiating objects.
- * @param args
- * Arguments to pass to the constructor.
- * Constructors matching the arguments are always used before
no-arg constructors.
- * @return A new property instance.
- */
- @Deprecated
- public <T> T getInstanceProperty(String key, Class<T> type, Object def,
ResourceResolver resolver, Object...args) {
- return getInstanceProperty(key, null, type, def, resolver,
args);
- }
-
- /**
- * Returns an instance of the specified class, string, or object
property.
- *
- * @param key The property name.
- * @param outer The outer object if the class we're instantiating is an
inner class.
- * @param type The class type of the property.
- * @param def
- * The default value if the property doesn't exist.
- * <br>Can either be an instance of <c>T</c>, or a
<code>Class<? <jk>extends</jk> T></code>.
- * @param resolver
- * The resolver to use for instantiating objects.
- * @param args
- * Arguments to pass to the constructor.
- * Constructors matching the arguments are always used before
no-arg constructors.
- * @return A new property instance.
- */
- @Deprecated
- public <T> T getInstanceProperty(String key, Object outer, Class<T>
type, Object def, ResourceResolver resolver, Object...args) {
- Assertions.assertArgNotNull("type", type);
- Property p = findProperty(key);
- if (p != null)
- return p.asInstance(outer, type, resolver, args);
- if (def == null)
- return null;
- if (def instanceof Class)
- return resolver.resolve(outer, (Class<T>)def, args);
- if (type.isInstance(def))
- return (T)def;
- throw new ConfigException("Could not instantiate property
''{0}'' as type ''{1}'' with default value ''{2}''", key, type, def);
- }
-
- /**
- * Returns an instance of the specified class, string, or object
property.
- *
- * @param key The property name.
- * @param type The class type of the property.
- * @param def
- * The default value if the property doesn't exist.
- * <br>Can either be an instance of <c>T</c>, or a
<code>Class<? <jk>extends</jk> T></code>.
* @param beanFactory The bean factory to use for instantiating the
bean.
* @return A new property instance.
*/
@@ -621,44 +570,6 @@ public final class PropertyStore {
* @param key The property name.
* @param type The class type of the property.
* @param def The default object to return if the property doesn't
exist.
- * @param resolver
- * The resolver to use for instantiating objects.
- * @param args
- * Arguments to pass to the constructor.
- * Constructors matching the arguments are always used before
no-arg constructors.
- * @return A new property instance.
- */
- @Deprecated
- public <T> T[] getInstanceArrayProperty(String key, Class<T> type, T[]
def, ResourceResolver resolver, Object...args) {
- return getInstanceArrayProperty(key, null, type, def, resolver,
args);
- }
-
- /**
- * Returns the specified property as an array of instantiated objects.
- *
- * @param key The property name.
- * @param outer The outer object if the class we're instantiating is an
inner class.
- * @param type The class type of the property.
- * @param def The default object to return if the property doesn't
exist.
- * @param resolver
- * The resolver to use for instantiating objects.
- * @param args
- * Arguments to pass to the constructor.
- * Constructors matching the arguments are always used before
no-arg constructors.
- * @return A new property instance.
- */
- @Deprecated
- public <T> T[] getInstanceArrayProperty(String key, Object outer,
Class<T> type, T[] def, ResourceResolver resolver, Object...args) {
- Property p = findProperty(key);
- return p == null ? def : p.asInstanceArray(outer, type,
resolver, args);
- }
-
- /**
- * Returns the specified property as an array of instantiated objects.
- *
- * @param key The property name.
- * @param type The class type of the property.
- * @param def The default object to return if the property doesn't
exist.
* @param beanFactory The bean factory to use for instantiating beans.
* @return A new property instance.
*/
@@ -989,31 +900,6 @@ public final class PropertyStore {
/**
* Converts this property to the specified instance type.
*
- * @param outer The outer class if this is a member type.
- * @param iType The type to instantiate.
- * @param resolver The resource resolver.
- * @param args The arguments to pass to the constructor.
- * @param <T> The type to instantiate.
- * @return The instantiated object.
- * @throws ConfigException If value could not be instantiated.
- */
- @Deprecated
- public <T> T asInstance(Object outer, Class<T> iType,
ResourceResolver resolver, Object...args) {
- if (value == null)
- return null;
- if (type == STRING)
- return fromString(iType, value.toString());
- else if (type == OBJECT || type == CLASS) {
- T t = instantiate(resolver, outer, iType,
value, args);
- if (t != null)
- return t;
- }
- throw new ConfigException("Invalid property
instantiation ''{0}'' to ''{1}'' on property ''{2}''", type, iType, name);
- }
-
- /**
- * Converts this property to the specified instance type.
- *
* @param iType The type to instantiate.
* @param beanFactory The bean factory to use for instantiating
beans.
* @param <T> The type to instantiate.
@@ -1036,40 +922,6 @@ public final class PropertyStore {
/**
* Converts this property to an array of specified instance
type.
*
- * @param outer The outer class if this is a member type.
- * @param eType The entry type to instantiate.
- * @param resolver The resource resolver.
- * @param args The arguments to pass to the constructor.
- * @param <T> The type to instantiate.
- * @return The instantiated object.
- * @throws ConfigException If value could not be instantiated.
- */
- @Deprecated
- public <T> T[] asInstanceArray(Object outer, Class<T> eType,
ResourceResolver resolver, Object...args) {
- if (value instanceof Collection) {
- Collection<?> l = (Collection<?>)value;
- Object t = Array.newInstance(eType, l.size());
- int i = 0;
- for (Object o : l) {
- Object o2 = null;
- if (eType.isInstance(o))
- o2 = o;
- else if (type == SET_STRING || type ==
LIST_STRING)
- o2 = fromString(eType,
o.toString());
- else if (type == SET_CLASS || type ==
LIST_CLASS || type == LIST_OBJECT)
- o2 = instantiate(resolver,
outer, eType, o, args);
- if (o2 == null)
- throw new
ConfigException("Invalid property conversion ''{0}'' to ''{1}[]'' on property
''{2}''", type, eType, name);
- Array.set(t, i++, o2);
- }
- return (T[])t;
- }
- throw new ConfigException("Invalid property conversion
''{0}'' to ''{1}[]'' on property ''{2}''", type, eType, name);
- }
-
- /**
- * Converts this property to an array of specified instance
type.
- *
* @param eType The entry type to instantiate.
* @param beanFactory The bean factory to use to instantiate
beans.
* @param <T> The type to instantiate.
@@ -1122,15 +974,6 @@ public final class PropertyStore {
// Utility methods
//-------------------------------------------------------------------------------------------------------------------
- @Deprecated
- static <T> T instantiate(ResourceResolver resolver, Object outer,
Class<T> c, Object value, Object...args) {
- if (ClassInfo.of(c).isParentOf(value.getClass()))
- return (T)value;
- if (ClassInfo.of(value.getClass()).isChildOf(Class.class))
- return resolver.resolve(outer, (Class<T>)value, args);
- return null;
- }
-
static <T> T instantiate(BeanFactory beanFactory, Class<T> c, Object
value) {
if (ClassInfo.of(c).isParentOf(value.getClass()))
return (T)value;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ResourceResolver.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ResourceResolver.java
deleted file mode 100644
index 3ef3ba3..0000000
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ResourceResolver.java
+++ /dev/null
@@ -1,47 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau;
-
-/**
- * Class used to resolve {@link Class} objects to instances.
- */
-@Deprecated
-public interface ResourceResolver {
-
- /**
- * Look for constructors where the arguments passed in must match
exactly.
- */
- public static final ResourceResolver BASIC = new
BasicResourceResolver();
-
- /**
- * Look for constructors where arguments may or may not exist in any
order.
- */
- public static final ResourceResolver FUZZY = new
FuzzyResourceResolver();
-
- /**
- * Resolves the specified class to a resource object.
- *
- * <p>
- * Subclasses can override this method to provide their own custom
resolution.
- *
- * <p>
- * The default implementation simply creates a new class instance using
{@link Class#newInstance()}.
- *
- * @param parent
- * The parent resource.
- * @param c The class to resolve.
- * @param args Optional arguments to pass to constructor
- * @return The instance of that class.
- */
- <T> T resolve(Object parent, Class<T> c, Object...args);
-}
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
deleted file mode 100644
index 7bdc4c5..0000000
---
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauRestInitializer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest.springboot;
-
-import static java.lang.System.*;
-import org.apache.juneau.rest.springboot.annotation.*;
-import org.springframework.context.ApplicationContextInitializer;
-import org.springframework.context.ConfigurableApplicationContext;
-
-/**
- * Spring Boot context initializer for Juneau REST resources.
- *
- * <p>
- * Looks for the {@link JuneauRestRoot} annotation on the Spring application
class to automatically register Juneau REST resources.
- */
-@Deprecated
-public class JuneauRestInitializer implements
ApplicationContextInitializer<ConfigurableApplicationContext> {
-
- private final Class<?> appClass;
-
- /**
- * Constructor.
- *
- * @param appClass The Spring application class. Can be <jk>null</jk>.
- */
- public JuneauRestInitializer(Class<?> appClass) {
- this.appClass = appClass;
- }
-
- /**
- * Constructor.
- */
- public JuneauRestInitializer() {
- this.appClass = null;
- }
-
- @Override /* ApplicationContextInitializer */
- public void initialize(ConfigurableApplicationContext ctx) {
- String port = ctx.getEnvironment().getProperty("server.port");
- if (port != null && getProperty("juneau.serverPort") == null)
- setProperty("juneau.serverPort", port);
- 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
deleted file mode 100644
index c1a9cc1..0000000
---
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/JuneauRestPostProcessor.java
+++ /dev/null
@@ -1,94 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest.springboot;
-
-import org.apache.juneau.rest.*;
-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;
-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 JuneauRestRoot} annotation on the Spring application
class and <ja>@Bean</ja> methods.
- */
-@Deprecated
-public class JuneauRestPostProcessor implements
BeanDefinitionRegistryPostProcessor {
-
- private final Class<?> appClass;
-// private final RestResourceResolver restResourceResolver;
- private BeanDefinitionRegistry registry;
-
- /**
- * Constructor.
- *
- * @param ctx The spring application context.
- * @param appClass The spring application class. Can be <jk>null</jk>.
- */
- 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 postProcessBeanFactory(ConfigurableListableBeanFactory
beanFactory) throws BeansException {
- try {
- Map<String,RestServlet> m = new LinkedHashMap<>();
-
- // @JuneauRestRoot on App class.
- if (appClass != null) {
- JuneauRestRoot a =
appClass.getAnnotation(JuneauRestRoot.class);
- if (a != null)
- for (Class<? extends RestServlet> c :
a.servlets())
- m.put(c.getName(),
c.newInstance());
- }
-
- // @JuneauRestRoot on classes.
- for (Map.Entry<String,Object> e :
beanFactory.getBeansWithAnnotation(JuneauRestRoot.class).entrySet())
- if (e.getValue() instanceof RestServlet)
- m.put(e.getKey(), (RestServlet)
e.getValue());
-
- // @JuneauRestRoot 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(JuneauRestRoot.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));
- }
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-}
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
deleted file mode 100644
index 0167220..0000000
---
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/SpringRestResourceResolver.java
+++ /dev/null
@@ -1,75 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest.springboot;
-
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-import org.springframework.context.ApplicationContext;
-
-/**
- * Implementation of a {@link RestResourceResolver} for resolving resource
classes using Spring.
- *
- * <p>
- * Used for resolving resource classes defined via {@link Rest#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>
- */
-@Deprecated
-public class SpringRestResourceResolver extends BasicRestResourceResolver {
-
- private ApplicationContext ctx;
-
- /**
- * Constructor.
- *
- * @param ctx The spring application context object.
- */
- 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 = ctx.getBean(c);
- } catch (Exception e) { /* Ignore */ }
- if (resource == null)
- resource = super.resolve(parent, c, builder);
- return resource;
- }
-}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestResourceResolver.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestResourceResolver.java
deleted file mode 100644
index 4be2dc3..0000000
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestResourceResolver.java
+++ /dev/null
@@ -1,46 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest;
-
-import org.apache.juneau.*;
-import org.apache.juneau.internal.*;
-
-/**
- * Denotes the default resolver for child resources.
- *
- * The default implementation simply instantiates the class using one of the
following constructors:
- * <ul>
- * <li><code><jk>public</jk> T(RestContextBuilder)</code>
- * <li><code><jk>public</jk> T()</code>
- * </ul>
- *
- * <p>
- * The former constructor can be used to get access to the {@link
RestContextBuilder} object to get access to the
- * config file and initialization information or make programmatic
modifications to the resource before
- * full initialization.
- *
- * <p>
- * Child classes can also be defined as inner-classes of the parent resource
class.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc RestResourceResolvers}
- * </ul>
- */
-@Deprecated
-public class BasicRestResourceResolver extends FuzzyResourceResolver
implements RestResourceResolver {
-
- @Override /* RestResourceResolver */
- public <T> T resolve(Object parent, Class<T> c, RestContextBuilder
builder, Object...args) {
- return resolve(parent, c, ArrayUtils.append(args, builder,
builder.getConfig()));
- }
-}
\ No newline at end of file
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResourceResolver.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResourceResolver.java
deleted file mode 100644
index 737c24e..0000000
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResourceResolver.java
+++ /dev/null
@@ -1,74 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest;
-
-import org.apache.juneau.*;
-import org.apache.juneau.rest.annotation.*;
-
-/**
- * Class used to resolve {@link Class} objects to instances.
- *
- * <p>
- * Used to convert classes defined via {@link Rest#children() @Rest(children)}
into child instances.
- *
- * <p>
- * Subclasses can be created to provide customized resource resolution.
- * These can be associated with REST resources in one of the following ways:
- * <ul>
- * <li>{@link Rest#resourceResolver() @Rest(resourceResolver)} annotation.
- * <li>{@link RestContextBuilder#resourceResolver(Class)}/{@link
RestContextBuilder#resourceResolver(RestResourceResolver)}
- * methods.
- * </ul>
- *
- * Implementations must provide one of the following public constructors:
- * <ul>
- * <li>RestResourceResolver()
- * <li>RestResourceResolver(RestContext)
- * </ul>
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc RestResourceResolvers}
- * </ul>
- */
-@SuppressWarnings("javadoc")
-@Deprecated
-public interface RestResourceResolver extends ResourceResolver {
-
- /**
- * Represents no RestResourceResolver.
- *
- * <p>
- * Used on annotation to indicate that the value should be inherited
from the parent class, and
- * ultimately {@link BasicRestResourceResolver} if not specified at any
level.
- */
- public interface Null extends RestResourceResolver {}
-
- /**
- * Resolves the specified class to a resource object.
- *
- * <p>
- * Subclasses can override this method to provide their own custom
resolution.
- *
- * <p>
- * The default implementation simply creates a new class instance using
{@link Class#newInstance()}.
- *
- * @param parent
- * The parent resource (i.e. the instance whose class has the
{@link Rest#children() @Rest(children)} annotation.
- * @param c The class to resolve.
- * @param builder The initialization configuration for the resource.
- * @param args Optional arguments to pass to constructor
- * @return The instance of that class.
- * @throws Exception If class could not be resolved.
- */
- <T> T resolve(Object parent, Class<T> c, RestContextBuilder builder,
Object...args) throws Exception;
-}