Consider abstract classes with @Lookup methods as candidate components

Issue: SPR-14550
This commit is contained in:
Juergen Hoeller
2017-01-23 17:28:18 +01:00
parent ed40b1c8ee
commit 7d3fcaa934
8 changed files with 164 additions and 80 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-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.
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component;
@Component
public @interface DevComponent {
public static final String PROFILE_NAME = "dev";
String PROFILE_NAME = "dev";
String value() default "";

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2002-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 example.profilescan;
import org.springframework.context.annotation.Profile;
@@ -8,6 +24,7 @@ import org.springframework.stereotype.Component;
public class ProfileAnnotatedComponent {
public static final String BEAN_NAME = "profileAnnotatedComponent";
public static final String PROFILE_NAME = "test";
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-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.
@@ -16,10 +16,9 @@
package example.profilescan;
@DevComponent(ProfileMetaAnnotatedComponent.BEAN_NAME)
public class ProfileMetaAnnotatedComponent {
public static final String BEAN_NAME = "profileMetaAnnotatedComponent";
}
}

View File

@@ -0,0 +1,24 @@
/*
* Copyright 2002-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 example.profilescan;
import org.springframework.stereotype.Component;
@Component
public abstract class SomeAbstractClass {
}