DATACMNS-977 - Added @Indexed to core annotations and types to be indexed for component scanning.

Equipped @Persistent, @RepositoryDefinition and our Repository marker interface with @Indexed so that Spring 5's annotation processor will detect types annotated with or extending the aforementioned type for inclusion in the component index.

Related ticket: SPR-11890.
This commit is contained in:
Oliver Gierke
2017-01-18 19:12:47 +01:00
parent db17a28238
commit 74426c01e1
3 changed files with 32 additions and 6 deletions

View File

@@ -1,11 +1,11 @@
/*
* Copyright (c) 2011 by the original author(s).
* Copyright 2011-2017 the original author or authors.
*
* Licensed 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,
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.annotation;
import java.lang.annotation.ElementType;
@@ -21,10 +20,16 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.stereotype.Indexed;
/**
* @author J. Brisbin <jbrisbin@vmware.com>
* Annotation to generally identify persistent types, fields and parameters.
*
* @author Jon Brisbin
* @author Oliver Gierke
*/
@Indexed
@Retention(RetentionPolicy.RUNTIME)
@Target(value = { ElementType.TYPE, ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.PARAMETER })
@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER })
public @interface Persistent {
}

View File

@@ -1,7 +1,24 @@
/*
* Copyright 20011-2017 the original author or authors.
*
* Licensed 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.springframework.data.repository;
import java.io.Serializable;
import org.springframework.stereotype.Indexed;
/**
* Central repository marker interface. Captures the domain type to manage as well as the domain type's id type. General
* purpose is to hold type information as well as being able to discover interfaces that extend this one during
@@ -15,6 +32,7 @@ import java.io.Serializable;
* @param <ID> the type of the id of the entity the repository manages
* @author Oliver Gierke
*/
@Indexed
public interface Repository<T, ID extends Serializable> {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011 the original author or authors.
* Copyright 2011-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,8 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.stereotype.Indexed;
/**
* Annotation to demarcate interfaces a repository proxy shall be created for. Annotating an interface with
* {@link RepositoryDefinition} will cause the same behaviour as extending {@link Repository}.
@@ -30,6 +32,7 @@ import java.lang.annotation.Target;
* @see Repository
* @author Oliver Gierke
*/
@Indexed
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)