Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public HttpExchangeClassPathScanningCandidateComponentProvider() {
@Override
protected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) {
AnnotationMetadata metadata = beanDefinition.getMetadata();
return (metadata.isIndependent() && !metadata.isAnnotation());
return (metadata.isInterface() && metadata.isIndependent() && !metadata.isAnnotation());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ void basicScan() {
assertBeanDefinitionCount(3);
}

@Test // gh-36993
void scanIgnoresConcreteClassImplementingHttpExchangeInterface() {
doRegister(registry -> registry.forGroup(ECHO_GROUP).detectInBasePackages(EchoA.class));

// EchoAImpl implements EchoA but is not itself an interface, and must not
// be registered as an HTTP Service client alongside EchoA and EchoB.
assertRegistryBeanDef(new TestGroup(ECHO_GROUP, EchoA.class, EchoB.class));
assertBeanDefinitionCount(3);
}

@Test
void merge() {
doRegister(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2002-present 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
*
* https://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.web.service.registry.echo;

/**
* Concrete class implementing an {@code @HttpExchange} interface, present in the
* scanned package to verify that classpath scanning for HTTP Service interfaces
* ignores such classes rather than registering them as HTTP Service clients.
*/
public class EchoAImpl implements EchoA {

@Override
public String handle(String input) {
return input;
}

}