sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject [sling-org-apache-sling-models-impl] 01/01: SLING-8452 migrate to OSGi annotations
Date Fri, 31 May 2019 15:13:38 GMT
This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/osgi-annotations
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git

commit 34ba18b413135271036af911c9815cce77bafd9c
Author: Konrad Windszus <kwin@apache.org>
AuthorDate: Fri May 31 17:13:26 2019 +0200

    SLING-8452 migrate to OSGi annotations
    
    also update to the most recent Sling parent which required to increase
    the minimum java version to 8
---
 bnd.bnd                                            |  10 ++
 pom.xml                                            | 138 +++++++++------------
 .../models/impl/FirstImplementationPicker.java     |   8 +-
 .../sling/models/impl/ModelAdapterFactory.java     | 138 ++++++---------------
 .../impl/ModelAdapterFactoryConfiguration.java     |  12 ++
 .../impl/ResourceTypeBasedResourcePicker.java      |   8 +-
 .../models/impl/injectors/BindingsInjector.java    |   8 +-
 .../impl/injectors/ChildResourceInjector.java      |   8 +-
 .../models/impl/injectors/OSGiServiceInjector.java |  10 +-
 .../impl/injectors/RequestAttributeInjector.java   |   8 +-
 .../impl/injectors/ResourcePathInjector.java       |   8 +-
 .../sling/models/impl/injectors/SelfInjector.java  |   8 +-
 .../models/impl/injectors/SlingObjectInjector.java |   8 +-
 .../models/impl/injectors/ValueMapInjector.java    |   8 +-
 .../models/impl/via/BeanPropertyViaProvider.java   |  12 +-
 .../models/impl/via/ChildResourceViaProvider.java  |   4 +-
 .../impl/via/ForcedResourceTypeViaProvider.java    |   4 +-
 .../impl/via/ResourceSuperTypeViaProvider.java     |   4 +-
 18 files changed, 149 insertions(+), 255 deletions(-)

diff --git a/bnd.bnd b/bnd.bnd
new file mode 100644
index 0000000..d224102
--- /dev/null
+++ b/bnd.bnd
@@ -0,0 +1,10 @@
+# Remove those package imports because embedded and relocated via shade plugin (see below)
+Import-Package:\
+    !org.apache.sling.commons.osgi,\
+    !org.apache.sling.scripting.core.impl.helper,\
+    *
+Provide-Capability:\
+    osgi.service;objectClass=java.lang.Runnable,\
+    osgi.service;objectClass=javax.servlet.Servlet,\
+    osgi.service;objectClass=org.apache.sling.api.adapter.AdapterFactory,\
+    osgi.service;objectClass=org.apache.sling.models.factory.ModelFactory
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 6ef84dc..af1a3c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,32 +1,32 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <!--
-  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
+    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
+    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.
+    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.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.sling</groupId>
-        <artifactId>sling</artifactId>
-        <version>26</version>
-        <relativePath />
+        <artifactId>sling-bundle-parent</artifactId>
+        <version>35</version>
+        <relativePath/>
     </parent>
     <artifactId>org.apache.sling.models.impl</artifactId>
-    <packaging>bundle</packaging>
     <version>1.4.11-SNAPSHOT</version>
     <name>Apache Sling Models Implementation</name>
     <description>Apache Sling Models Implementation</description>
@@ -35,42 +35,24 @@
         <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git</connection>
         <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git</developerConnection>
         <url>https://gitbox.apache.org/repos/asf?p=sling-org-apache-sling-models-impl.git</url>
-      <tag>HEAD</tag>
-  </scm>
+        <tag>HEAD</tag>
+    </scm>
     <properties>
-        <sling.java.version>7</sling.java.version>
+        <sling.java.version>8</sling.java.version>
     </properties>
     <build>
         <plugins>
             <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
+                <groupId>biz.aQute.bnd</groupId>
+                <artifactId>bnd-maven-plugin</artifactId>
             </plugin>
             <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <configuration>
-                  <instructions>
-                    <!-- Remove those package imports because embedded and relocated via shade plugin (see below) -->
-                    <Import-Package>
-                      !org.apache.sling.commons.osgi,
-                      !org.apache.sling.scripting.core.impl.helper,
-                      *
-                    </Import-Package>
-                    <Provide-Capability>
-                      osgi.service;objectClass=java.lang.Runnable,
-                      osgi.service;objectClass=javax.servlet.Servlet,
-                      osgi.service;objectClass=org.apache.sling.api.adapter.AdapterFactory,
-                      osgi.service;objectClass=org.apache.sling.models.factory.ModelFactory
-                    </Provide-Capability>
-                  </instructions>
-                </configuration>
+                <groupId>biz.aQute.bnd</groupId>
+                <artifactId>bnd-baseline-maven-plugin</artifactId>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-shade-plugin</artifactId>
-                <version>2.4.3</version>
                 <executions>
                     <execution>
                         <phase>package</phase>
@@ -139,27 +121,28 @@
             <version>1.3.6</version>
             <scope>provided</scope>
         </dependency>
+        <!-- OSGi annotations (only relevant at build time) -->
         <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
-            <version>6.0.0</version>
+            <artifactId>org.osgi.service.metatype.annotations</artifactId>
             <scope>provided</scope>
         </dependency>
+        <!-- regular compile-time dependencies -->
         <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-            <version>3.4</version>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.4</version><!-- still Servlet 2.4 -->
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.core</artifactId>
-            <version>6.0.0</version>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.4</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -185,6 +168,27 @@
             <version>1</version>
             <scope>provided</scope>
         </dependency>
+        <!-- Artifact is shaded and inlined, only some classes included (see above) -->
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.osgi</artifactId>
+            <version>2.4.0</version>
+            <scope>compile</scope>
+        </dependency>
+        <!-- Artifact is shaded and inlined, only some classes included (see above) -->
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.scripting.core</artifactId>
+            <version>2.0.20</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jetbrains</groupId>
+            <artifactId>annotations</artifactId>
+            <version>16.0.2</version>
+            <scope>provided</scope>
+        </dependency>
+        <!-- Test dependencies -->
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
@@ -213,31 +217,5 @@
             <artifactId>slf4j-simple</artifactId>
             <scope>test</scope>
         </dependency>
-        <!-- Artifact is shaded and inlined, only some classes included (see above) -->
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.commons.osgi</artifactId>
-            <version>2.4.0</version>
-            <scope>compile</scope>
-        </dependency>
-        <!-- Artifact is shaded and inlined, only some classes included (see above) -->
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.scripting.core</artifactId>
-            <version>2.0.20</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-            <version>2.5</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.jetbrains</groupId>
-            <artifactId>annotations</artifactId>
-            <version>16.0.2</version>
-            <scope>provided</scope>
-        </dependency>
     </dependencies>
 </project>
diff --git a/src/main/java/org/apache/sling/models/impl/FirstImplementationPicker.java b/src/main/java/org/apache/sling/models/impl/FirstImplementationPicker.java
index 230ba2c..36ae87d 100644
--- a/src/main/java/org/apache/sling/models/impl/FirstImplementationPicker.java
+++ b/src/main/java/org/apache/sling/models/impl/FirstImplementationPicker.java
@@ -18,11 +18,9 @@
  */
 package org.apache.sling.models.impl;
 
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.models.spi.ImplementationPicker;
 import org.osgi.framework.Constants;
+import org.osgi.service.component.annotations.Component;
 
 /**
  * Picks first implementation.
@@ -31,9 +29,7 @@ import org.osgi.framework.Constants;
  * But at least it gives a consistent behavior.
  * It's service ranking is set to the highest value to allow more intelligent implementations to step in.
  */
-@Component
-@Service
-@Property(name = Constants.SERVICE_RANKING, intValue = Integer.MAX_VALUE)
+@Component(property=Constants.SERVICE_RANKING+":Integer="+Integer.MAX_VALUE)
 public class FirstImplementationPicker implements ImplementationPicker {
 
     @Override
diff --git a/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java b/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
index cf60a09..f88b0f7 100644
--- a/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
+++ b/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
@@ -29,7 +29,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Dictionary;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Hashtable;
@@ -47,23 +46,11 @@ import javax.servlet.ServletRequestListener;
 import javax.servlet.ServletRequestWrapper;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.apache.felix.scr.annotations.ReferencePolicy;
-import org.apache.felix.scr.annotations.ReferencePolicyOption;
-import org.apache.felix.scr.annotations.References;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.adapter.Adaptable;
 import org.apache.sling.api.adapter.AdapterFactory;
 import org.apache.sling.api.adapter.AdapterManager;
 import org.apache.sling.api.resource.Resource;
-import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.commons.osgi.RankedServices;
 import org.apache.sling.models.annotations.Model;
 import org.apache.sling.models.annotations.ValidationStrategy;
@@ -105,29 +92,22 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.ReferencePolicy;
+import org.osgi.service.component.annotations.ReferencePolicyOption;
 import org.osgi.service.http.whiteboard.HttpWhiteboardConstants;
+import org.osgi.service.metatype.annotations.Designate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@Component(metatype = true, immediate = true,
-        label = "Apache Sling Model Adapter Factory")
-@Service(value = { ModelFactory.class, ServletRequestListener.class })
-@Properties({
-    @Property(name = HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, value = "true"),
-    @Property(name = HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, value = "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=*)")
-})
-@References({
-    @Reference(
-        name = "injector",
-        referenceInterface = Injector.class,
-        cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE,
-        policy = ReferencePolicy.DYNAMIC),
-    @Reference(
-            name = "viaProvider",
-            referenceInterface = ViaProvider.class,
-            cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE,
-            policy = ReferencePolicy.DYNAMIC)
-})
+@Component(immediate = true, service={ ModelFactory.class, ServletRequestListener.class }, 
+    property= { HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER+"=true", 
+                HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT+"=(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=*)" })
+@Designate(ocd=ModelAdapterFactoryConfiguration.class)
 @SuppressWarnings("deprecation")
 public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFactory, ServletRequestListener {
 
@@ -233,43 +213,26 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
 
     private static final Logger log = LoggerFactory.getLogger(ModelAdapterFactory.class);
 
-    private static final int DEFAULT_MAX_RECURSION_DEPTH = 20;
-
-    private static final long DEFAULT_CLEANUP_JOB_PERIOD = 30l;
-
-    @Property(label = "Maximum Recursion Depth", description = "Maximum depth adaptation will be attempted.", intValue = DEFAULT_MAX_RECURSION_DEPTH)
-    private static final String PROP_MAX_RECURSION_DEPTH = "max.recursion.depth";
-
-    @Property(label = "Cleanup Job Period", description = "Period at which OSGi service references from ThreadLocals will be cleaned up.", longValue = DEFAULT_CLEANUP_JOB_PERIOD)
-    private static final String PROP_CLEANUP_JOB_PERIOD = "cleanup.job.period";
-
     private final @NotNull ConcurrentMap<String, RankedServices<Injector>> injectors = new ConcurrentHashMap<>();
     private final @NotNull RankedServices<Injector> sortedInjectors = new RankedServices<>();
     private final @NotNull ConcurrentMap<Class<? extends ViaProviderType>, ViaProvider> viaProviders = new ConcurrentHashMap<>();
 
-    @Reference(name = "injectAnnotationProcessorFactory", referenceInterface = InjectAnnotationProcessorFactory.class,
-            cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC)
-    private final @NotNull RankedServices<InjectAnnotationProcessorFactory> injectAnnotationProcessorFactories = new RankedServices<>();
+    @Reference(name="injectAnnotationProcessorFactory", cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
+    private volatile @NotNull Collection<InjectAnnotationProcessorFactory> injectAnnotationProcessorFactories; // this must be non-final for fieldOption=replace!
 
-    @Reference(name = "injectAnnotationProcessorFactory2", referenceInterface = InjectAnnotationProcessorFactory2.class,
-            cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC)
-    private final @NotNull RankedServices<InjectAnnotationProcessorFactory2> injectAnnotationProcessorFactories2 = new RankedServices<>();
+    @Reference(name="injectAnnotationProcessorFactory2", cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
+    private volatile @NotNull Collection<InjectAnnotationProcessorFactory2> injectAnnotationProcessorFactories2; // this must be non-final for fieldOption=replace!
 
-    @Reference(name = "staticInjectAnnotationProcessorFactory", referenceInterface = StaticInjectAnnotationProcessorFactory.class,
-            cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC)
     private final @NotNull RankedServices<StaticInjectAnnotationProcessorFactory> staticInjectAnnotationProcessorFactories = new RankedServices<>();
 
-    @Reference(name = "implementationPicker", referenceInterface = ImplementationPicker.class,
-            cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC)
     private final @NotNull RankedServices<ImplementationPicker> implementationPickers = new RankedServices<>();
 
     // bind the service with the highest priority (if a new one comes in this service gets restarted)
-    @Reference(cardinality=ReferenceCardinality.OPTIONAL_UNARY, policyOption=ReferencePolicyOption.GREEDY)
+    @Reference(cardinality=ReferenceCardinality.OPTIONAL, policyOption=ReferencePolicyOption.GREEDY)
     private ModelValidation modelValidation = null;
 
-    @Reference(name = "modelExporter", cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC,
-            referenceInterface = ModelExporter.class)
-    private final @NotNull RankedServices<ModelExporter> modelExporters = new RankedServices<>();
+    @Reference(name = "modelExporter", cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
+    private volatile @NotNull Collection<ModelExporter> modelExporters; // this must be non-final for fieldOption=replace!
 
     @Reference
     private BindingsValuesProvidersByContext bindingsValuesProvidersByContext;
@@ -288,7 +251,7 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
     // Use threadlocal to count recursive invocations and break recursing if a max. limit is reached (to avoid cyclic dependencies)
     private ThreadLocal<ThreadInvocationCounter> invocationCountThreadLocal;
 
-    private Map<Object, Map<Class, SoftReference<Object>>> adapterCache;
+    private Map<Object, Map<Class<?>, SoftReference<Object>>> adapterCache;
 
     private SlingModelsScriptEngineFactory scriptEngineFactory;
 
@@ -401,7 +364,7 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
             Model modelAnnotation = modelClass.getModelAnnotation();
 
             if (modelAnnotation.cache()) {
-                Map<Class, SoftReference<Object>> adaptableCache = adapterCache.get(adaptable);
+                Map<Class<?>, SoftReference<Object>> adaptableCache = adapterCache.get(adaptable);
                 if (adaptableCache != null) {
                     SoftReference<Object> SoftReference = adaptableCache.get(requestedType);
                     ModelType cachedObject = (ModelType) SoftReference.get();
@@ -431,9 +394,9 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
                         ModelType model = (ModelType) Proxy.newProxyInstance(modelClass.getType().getClassLoader(), new Class<?>[] { modelClass.getType() }, handlerResult.getValue());
 
                         if (modelAnnotation.cache()) {
-                            Map<Class, SoftReference<Object>> adaptableCache = adapterCache.get(adaptable);
+                            Map<Class<?>, SoftReference<Object>> adaptableCache = adapterCache.get(adaptable);
                             if (adaptableCache == null) {
-                                adaptableCache = Collections.synchronizedMap(new WeakHashMap<Class, SoftReference<Object>>());
+                                adaptableCache = Collections.synchronizedMap(new WeakHashMap<Class<?>, SoftReference<Object>>());
                                 adapterCache.put(adaptable, adaptableCache);
                             }
                             adaptableCache.put(requestedType, new SoftReference<Object>(model));
@@ -448,9 +411,9 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
                         result = createObject(adaptable, modelClass);
 
                         if (result.wasSuccessful() && modelAnnotation.cache()) {
-                            Map<Class, SoftReference<Object>> adaptableCache = adapterCache.get(adaptable);
+                            Map<Class<?>, SoftReference<Object>> adaptableCache = adapterCache.get(adaptable);
                             if (adaptableCache == null) {
-                                adaptableCache = Collections.synchronizedMap(new WeakHashMap<Class, SoftReference<Object>>());
+                                adaptableCache = Collections.synchronizedMap(new WeakHashMap<Class<?>, SoftReference<Object>>());
                                 adapterCache.put(adaptable, adaptableCache);
                             }
                             adaptableCache.put(requestedType, new SoftReference<Object>(result.getValue()));
@@ -1130,17 +1093,15 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
     }
 
     @Activate
-    protected void activate(final ComponentContext ctx) {
-        Dictionary<?, ?> props = ctx.getProperties();
-        final int maxRecursionDepth = PropertiesUtil.toInteger(props.get(PROP_MAX_RECURSION_DEPTH), DEFAULT_MAX_RECURSION_DEPTH);
+    protected void activate(final ComponentContext ctx, final ModelAdapterFactoryConfiguration configuration) {
         this.invocationCountThreadLocal = new ThreadLocal<ThreadInvocationCounter>() {
             @Override
             protected ThreadInvocationCounter initialValue() {
-                return new ThreadInvocationCounter(maxRecursionDepth);
+                return new ThreadInvocationCounter(configuration.max_recursion_depth());
             }
         };
 
-        this.adapterCache = Collections.synchronizedMap(new WeakHashMap<Object, Map<Class, SoftReference<Object>>>());
+        this.adapterCache = Collections.synchronizedMap(new WeakHashMap<Object, Map<Class<?>, SoftReference<Object>>>());
 
         BundleContext bundleContext = ctx.getBundleContext();
         this.queue = new ReferenceQueue<>();
@@ -1151,7 +1112,7 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
         properties.put(Constants.SERVICE_DESCRIPTION, "Sling Models OSGi Service Disposal Job");
         properties.put("scheduler.name", "Sling Models OSGi Service Disposal Job");
         properties.put("scheduler.concurrent", false);
-        properties.put("scheduler.period", PropertiesUtil.toLong(props.get(PROP_CLEANUP_JOB_PERIOD), DEFAULT_CLEANUP_JOB_PERIOD));
+        properties.put("scheduler.period", configuration.cleanup_job_period());
 
         this.jobRegistration = bundleContext.registerService(Runnable.class, this, properties);
 
@@ -1192,6 +1153,8 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
         }
     }
 
+    @Reference(cardinality = ReferenceCardinality.MULTIPLE,
+            policy = ReferencePolicy.DYNAMIC)
     protected void bindInjector(final Injector injector, final Map<String, Object> props) {
         RankedServices<Injector> newRankedServices = new RankedServices<>();
         RankedServices<Injector> injectorsPerInjectorName = injectors.putIfAbsent(injector.getName(), newRankedServices);
@@ -1210,22 +1173,7 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
         sortedInjectors.unbind(injector, props);
     }
 
-    protected void bindInjectAnnotationProcessorFactory(final InjectAnnotationProcessorFactory factory, final Map<String, Object> props) {
-        injectAnnotationProcessorFactories.bind(factory, props);
-    }
-
-    protected void unbindInjectAnnotationProcessorFactory(final InjectAnnotationProcessorFactory factory, final Map<String, Object> props) {
-        injectAnnotationProcessorFactories.unbind(factory, props);
-    }
-
-    protected void bindInjectAnnotationProcessorFactory2(final InjectAnnotationProcessorFactory2 factory, final Map<String, Object> props) {
-        injectAnnotationProcessorFactories2.bind(factory, props);
-    }
-
-    protected void unbindInjectAnnotationProcessorFactory2(final InjectAnnotationProcessorFactory2 factory, final Map<String, Object> props) {
-        injectAnnotationProcessorFactories2.unbind(factory, props);
-    }
-
+    @Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
     protected void bindStaticInjectAnnotationProcessorFactory(final StaticInjectAnnotationProcessorFactory factory, final Map<String, Object> props) {
         synchronized (staticInjectAnnotationProcessorFactories) {
             staticInjectAnnotationProcessorFactories.bind(factory, props);
@@ -1240,6 +1188,7 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
         }
     }
 
+    @Reference(name="implementationPicker", cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
     protected void bindImplementationPicker(final ImplementationPicker implementationPicker, final Map<String, Object> props) {
         synchronized (implementationPickers) {
             implementationPickers.bind(implementationPicker, props);
@@ -1254,18 +1203,11 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
         }
     }
 
-    protected void bindModelExporter(final ModelExporter s, final Map<String, Object> props) {
-        synchronized (modelExporters) {
-            modelExporters.bind(s, props);
-        }
-    }
-
-    protected void unbindModelExporter(final ModelExporter s, final Map<String, Object> props) {
-        synchronized (modelExporters) {
-            modelExporters.unbind(s, props);
-        }
-    }
-
+    @Reference(
+            name = "viaProvider",
+            cardinality = ReferenceCardinality.MULTIPLE,
+            policy = ReferencePolicy.DYNAMIC
+            )
     protected void bindViaProvider(final ViaProvider viaProvider, final Map<String, Object> props) {
         Class<? extends ViaProviderType> type = viaProvider.getType();
         viaProviders.put(type, viaProvider);
@@ -1281,11 +1223,11 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
     }
 
     @NotNull Collection<InjectAnnotationProcessorFactory> getInjectAnnotationProcessorFactories() {
-        return injectAnnotationProcessorFactories.get();
+        return injectAnnotationProcessorFactories;
     }
 
     @NotNull Collection<InjectAnnotationProcessorFactory2> getInjectAnnotationProcessorFactories2() {
-        return injectAnnotationProcessorFactories2.get();
+        return injectAnnotationProcessorFactories2;
     }
 
     @NotNull Collection<StaticInjectAnnotationProcessorFactory> getStaticInjectAnnotationProcessorFactories() {
diff --git a/src/main/java/org/apache/sling/models/impl/ModelAdapterFactoryConfiguration.java b/src/main/java/org/apache/sling/models/impl/ModelAdapterFactoryConfiguration.java
new file mode 100644
index 0000000..f65cfa7
--- /dev/null
+++ b/src/main/java/org/apache/sling/models/impl/ModelAdapterFactoryConfiguration.java
@@ -0,0 +1,12 @@
+package org.apache.sling.models.impl;
+
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
+
+@ObjectClassDefinition(name = "Apache Sling Model Adapter Factory")
+public @interface ModelAdapterFactoryConfiguration {
+    @AttributeDefinition(name="Maximum Recursion Depth", description= "Maximum depth adaptation will be attempted.")
+    int max_recursion_depth() default 20;
+    @AttributeDefinition(name="Cleanup Job Period", description= "Period in seconds at which OSGi service references from ThreadLocals will be cleaned up.")
+    long cleanup_job_period() default 30l;
+}
diff --git a/src/main/java/org/apache/sling/models/impl/ResourceTypeBasedResourcePicker.java b/src/main/java/org/apache/sling/models/impl/ResourceTypeBasedResourcePicker.java
index 82b1337..7bf313a 100644
--- a/src/main/java/org/apache/sling/models/impl/ResourceTypeBasedResourcePicker.java
+++ b/src/main/java/org/apache/sling/models/impl/ResourceTypeBasedResourcePicker.java
@@ -19,19 +19,15 @@ package org.apache.sling.models.impl;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.models.annotations.Model;
 import org.apache.sling.models.spi.ImplementationPicker;
 import org.jetbrains.annotations.NotNull;
 import org.osgi.framework.Constants;
+import org.osgi.service.component.annotations.Component;
 
-@Component
-@Service
-@Property(name = Constants.SERVICE_RANKING, intValue = 0) // this must come before FirstImplementationPicker
+@Component(property=Constants.SERVICE_RANKING+":Integer=0") // this must come before FirstImplementationPicker
 public class ResourceTypeBasedResourcePicker implements ImplementationPicker {
 
     @Override
diff --git a/src/main/java/org/apache/sling/models/impl/injectors/BindingsInjector.java b/src/main/java/org/apache/sling/models/impl/injectors/BindingsInjector.java
index 077ff39..23ea4c9 100644
--- a/src/main/java/org/apache/sling/models/impl/injectors/BindingsInjector.java
+++ b/src/main/java/org/apache/sling/models/impl/injectors/BindingsInjector.java
@@ -22,9 +22,6 @@ import java.lang.reflect.Type;
 import javax.servlet.ServletRequest;
 
 import org.apache.commons.lang3.ObjectUtils;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.scripting.SlingBindings;
 import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
 import org.apache.sling.models.annotations.injectorspecific.ScriptVariable;
@@ -36,10 +33,9 @@ import org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessor2;
 import org.apache.sling.models.spi.injectorspecific.StaticInjectAnnotationProcessorFactory;
 import org.jetbrains.annotations.NotNull;
 import org.osgi.framework.Constants;
+import org.osgi.service.component.annotations.Component;
 
-@Component
-@Service
-@Property(name = Constants.SERVICE_RANKING, intValue = 1000)
+@Component(property=Constants.SERVICE_RANKING+":Integer=1000")
 public class BindingsInjector implements Injector, StaticInjectAnnotationProcessorFactory, ValuePreparer {
 
     @Override
diff --git a/src/main/java/org/apache/sling/models/impl/injectors/ChildResourceInjector.java b/src/main/java/org/apache/sling/models/impl/injectors/ChildResourceInjector.java
index 24a53dc..cf206da 100644
--- a/src/main/java/org/apache/sling/models/impl/injectors/ChildResourceInjector.java
+++ b/src/main/java/org/apache/sling/models/impl/injectors/ChildResourceInjector.java
@@ -24,9 +24,6 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.models.annotations.injectorspecific.ChildResource;
@@ -38,10 +35,9 @@ import org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessor2;
 import org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessorFactory2;
 import org.jetbrains.annotations.NotNull;
 import org.osgi.framework.Constants;
+import org.osgi.service.component.annotations.Component;
 
-@Component
-@Service
-@Property(name = Constants.SERVICE_RANKING, intValue = 3000)
+@Component(property=Constants.SERVICE_RANKING+":Integer=3000")
 public class ChildResourceInjector extends AbstractInjector implements Injector, InjectAnnotationProcessorFactory2 {
 
     @Override
diff --git a/src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java b/src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java
index bfea88e..3b6803a 100644
--- a/src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java
+++ b/src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java
@@ -27,10 +27,6 @@ import java.util.Collections;
 import java.util.List;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.models.annotations.Filter;
 import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
 import org.apache.sling.models.annotations.injectorspecific.OSGiService;
@@ -47,12 +43,12 @@ import org.osgi.framework.Constants;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@Component
-@Service
-@Property(name = Constants.SERVICE_RANKING, intValue = 5000)
+@Component(property=Constants.SERVICE_RANKING+":Integer=5000")
 public class OSGiServiceInjector implements Injector, StaticInjectAnnotationProcessorFactory, AcceptsNullName {
 
     private static final Logger log = LoggerFactory.getLogger(OSGiServiceInjector.class);
diff --git a/src/main/java/org/apache/sling/models/impl/injectors/RequestAttributeInjector.java b/src/main/java/org/apache/sling/models/impl/injectors/RequestAttributeInjector.java
index 4353988..383ca75 100644
--- a/src/main/java/org/apache/sling/models/impl/injectors/RequestAttributeInjector.java
+++ b/src/main/java/org/apache/sling/models/impl/injectors/RequestAttributeInjector.java
@@ -21,9 +21,6 @@ import java.lang.reflect.Type;
 
 import javax.servlet.ServletRequest;
 
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
 import org.apache.sling.models.annotations.injectorspecific.RequestAttribute;
 import org.apache.sling.models.spi.DisposalCallbackRegistry;
@@ -33,10 +30,9 @@ import org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessor2;
 import org.apache.sling.models.spi.injectorspecific.StaticInjectAnnotationProcessorFactory;
 import org.jetbrains.annotations.NotNull;
 import org.osgi.framework.Constants;
+import org.osgi.service.component.annotations.Component;
 
-@Component
-@Service
-@Property(name = Constants.SERVICE_RANKING, intValue = 4000)
+@Component(property=Constants.SERVICE_RANKING+":Integer=4000")
 public class RequestAttributeInjector implements Injector, StaticInjectAnnotationProcessorFactory {
 
     @Override
diff --git a/src/main/java/org/apache/sling/models/impl/injectors/ResourcePathInjector.java b/src/main/java/org/apache/sling/models/impl/injectors/ResourcePathInjector.java
index ea4a480..34fbfe3 100644
--- a/src/main/java/org/apache/sling/models/impl/injectors/ResourcePathInjector.java
+++ b/src/main/java/org/apache/sling/models/impl/injectors/ResourcePathInjector.java
@@ -25,9 +25,6 @@ import java.util.List;
 
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ValueMap;
@@ -42,12 +39,11 @@ import org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessor2;
 import org.apache.sling.models.spi.injectorspecific.StaticInjectAnnotationProcessorFactory;
 import org.jetbrains.annotations.NotNull;
 import org.osgi.framework.Constants;
+import org.osgi.service.component.annotations.Component;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@Component
-@Service
-@Property(name = Constants.SERVICE_RANKING, intValue = 2500)
+@Component(property=Constants.SERVICE_RANKING+":Integer=2500")
 public class ResourcePathInjector extends AbstractInjector implements Injector, AcceptsNullName,
         StaticInjectAnnotationProcessorFactory {
 
diff --git a/src/main/java/org/apache/sling/models/impl/injectors/SelfInjector.java b/src/main/java/org/apache/sling/models/impl/injectors/SelfInjector.java
index c7bde9a..e400ec8 100644
--- a/src/main/java/org/apache/sling/models/impl/injectors/SelfInjector.java
+++ b/src/main/java/org/apache/sling/models/impl/injectors/SelfInjector.java
@@ -19,9 +19,6 @@ package org.apache.sling.models.impl.injectors;
 import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Type;
 
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
 import org.apache.sling.models.annotations.injectorspecific.Self;
 import org.apache.sling.models.impl.model.ConstructorParameter;
@@ -33,13 +30,12 @@ import org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessor2;
 import org.apache.sling.models.spi.injectorspecific.StaticInjectAnnotationProcessorFactory;
 import org.jetbrains.annotations.NotNull;
 import org.osgi.framework.Constants;
+import org.osgi.service.component.annotations.Component;
 
 /**
  * Injects the adaptable object itself.
  */
-@Component
-@Service
-@Property(name = Constants.SERVICE_RANKING, intValue = Integer.MAX_VALUE)
+@Component(property=Constants.SERVICE_RANKING+":Integer="+Integer.MAX_VALUE)
 public class SelfInjector implements Injector, StaticInjectAnnotationProcessorFactory, AcceptsNullName {
 
     @Override
diff --git a/src/main/java/org/apache/sling/models/impl/injectors/SlingObjectInjector.java b/src/main/java/org/apache/sling/models/impl/injectors/SlingObjectInjector.java
index a2ab4b8..6676cd0 100644
--- a/src/main/java/org/apache/sling/models/impl/injectors/SlingObjectInjector.java
+++ b/src/main/java/org/apache/sling/models/impl/injectors/SlingObjectInjector.java
@@ -22,9 +22,6 @@ import java.lang.reflect.Type;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
 import org.apache.sling.api.resource.Resource;
@@ -41,15 +38,14 @@ import org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessor2;
 import org.apache.sling.models.spi.injectorspecific.StaticInjectAnnotationProcessorFactory;
 import org.jetbrains.annotations.NotNull;
 import org.osgi.framework.Constants;
+import org.osgi.service.component.annotations.Component;
 
 /**
  * Injects common Sling objects that can be derived from either a SlingHttpServletRequest, a ResourceResolver or a
  * Resource.
  * Documentation see {@link SlingObject}.
  */
-@Component
-@Service
-@Property(name = Constants.SERVICE_RANKING, intValue = Integer.MAX_VALUE)
+@Component(property=Constants.SERVICE_RANKING+":Integer="+Integer.MAX_VALUE)
 public final class SlingObjectInjector implements Injector, StaticInjectAnnotationProcessorFactory, AcceptsNullName {
 
     /**
diff --git a/src/main/java/org/apache/sling/models/impl/injectors/ValueMapInjector.java b/src/main/java/org/apache/sling/models/impl/injectors/ValueMapInjector.java
index 6606585..fdd91c0 100644
--- a/src/main/java/org/apache/sling/models/impl/injectors/ValueMapInjector.java
+++ b/src/main/java/org/apache/sling/models/impl/injectors/ValueMapInjector.java
@@ -27,9 +27,6 @@ import java.util.List;
 import org.apache.commons.lang3.ClassUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
@@ -42,12 +39,11 @@ import org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessor;
 import org.apache.sling.models.spi.injectorspecific.InjectAnnotationProcessorFactory;
 import org.jetbrains.annotations.NotNull;
 import org.osgi.framework.Constants;
+import org.osgi.service.component.annotations.Component;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@Component
-@Service
-@Property(name = Constants.SERVICE_RANKING, intValue = 2000)
+@Component(property=Constants.SERVICE_RANKING+":Integer=2000")
 @SuppressWarnings("deprecation")
 public class ValueMapInjector extends AbstractInjector implements Injector, InjectAnnotationProcessorFactory, ValuePreparer {
 
diff --git a/src/main/java/org/apache/sling/models/impl/via/BeanPropertyViaProvider.java b/src/main/java/org/apache/sling/models/impl/via/BeanPropertyViaProvider.java
index e05b04b..79b23b1 100644
--- a/src/main/java/org/apache/sling/models/impl/via/BeanPropertyViaProvider.java
+++ b/src/main/java/org/apache/sling/models/impl/via/BeanPropertyViaProvider.java
@@ -16,21 +16,19 @@
  */
 package org.apache.sling.models.impl.via;
 
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+
 import org.apache.commons.lang3.StringUtils;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.models.annotations.ViaProviderType;
 import org.apache.sling.models.annotations.via.BeanProperty;
 import org.apache.sling.models.spi.ViaProvider;
+import org.osgi.service.component.annotations.Component;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.beans.BeanInfo;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-
 @Component
-@Service
 public class BeanPropertyViaProvider implements ViaProvider {
 
     private static final Logger log = LoggerFactory.getLogger(BeanPropertyViaProvider.class);
diff --git a/src/main/java/org/apache/sling/models/impl/via/ChildResourceViaProvider.java b/src/main/java/org/apache/sling/models/impl/via/ChildResourceViaProvider.java
index f80a1a0..067910a 100644
--- a/src/main/java/org/apache/sling/models/impl/via/ChildResourceViaProvider.java
+++ b/src/main/java/org/apache/sling/models/impl/via/ChildResourceViaProvider.java
@@ -17,19 +17,17 @@
 package org.apache.sling.models.impl.via;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper;
 import org.apache.sling.models.annotations.ViaProviderType;
 import org.apache.sling.models.annotations.via.ChildResource;
 import org.apache.sling.models.spi.ViaProvider;
+import org.osgi.service.component.annotations.Component;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @Component
-@Service
 public class ChildResourceViaProvider implements ViaProvider {
 
     private static final Logger log = LoggerFactory.getLogger(ChildResourceViaProvider.class);
diff --git a/src/main/java/org/apache/sling/models/impl/via/ForcedResourceTypeViaProvider.java b/src/main/java/org/apache/sling/models/impl/via/ForcedResourceTypeViaProvider.java
index 07b865a..8818e2e 100644
--- a/src/main/java/org/apache/sling/models/impl/via/ForcedResourceTypeViaProvider.java
+++ b/src/main/java/org/apache/sling/models/impl/via/ForcedResourceTypeViaProvider.java
@@ -17,15 +17,13 @@
 package org.apache.sling.models.impl.via;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.models.annotations.ViaProviderType;
 import org.apache.sling.models.annotations.via.ForcedResourceType;
 import org.jetbrains.annotations.NotNull;
+import org.osgi.service.component.annotations.Component;
 
 @Component
-@Service
 public class ForcedResourceTypeViaProvider extends AbstractResourceTypeViaProvider {
     @Override
     public Class<? extends ViaProviderType> getType() {
diff --git a/src/main/java/org/apache/sling/models/impl/via/ResourceSuperTypeViaProvider.java b/src/main/java/org/apache/sling/models/impl/via/ResourceSuperTypeViaProvider.java
index 38481f1..dfe9bf9 100644
--- a/src/main/java/org/apache/sling/models/impl/via/ResourceSuperTypeViaProvider.java
+++ b/src/main/java/org/apache/sling/models/impl/via/ResourceSuperTypeViaProvider.java
@@ -16,15 +16,13 @@
  */
 package org.apache.sling.models.impl.via;
 
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.models.annotations.ViaProviderType;
 import org.apache.sling.models.annotations.via.ResourceSuperType;
 import org.jetbrains.annotations.NotNull;
+import org.osgi.service.component.annotations.Component;
 
 @Component
-@Service
 public class ResourceSuperTypeViaProvider extends AbstractResourceTypeViaProvider {
 
     @Override


Mime
View raw message