reimplemented bean lookup to avoid getBeanNamesForType(Object.class)
This commit is contained in:
parent
dc6c1dc727
commit
1b8a67d5d7
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package org.springframework.remoting.jaxws;
|
package org.springframework.remoting.jaxws;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
@ -26,9 +27,11 @@ import javax.xml.ws.WebServiceProvider;
|
||||||
|
|
||||||
import org.springframework.beans.factory.BeanFactory;
|
import org.springframework.beans.factory.BeanFactory;
|
||||||
import org.springframework.beans.factory.BeanFactoryAware;
|
import org.springframework.beans.factory.BeanFactoryAware;
|
||||||
|
import org.springframework.beans.factory.CannotLoadBeanClassException;
|
||||||
import org.springframework.beans.factory.DisposableBean;
|
import org.springframework.beans.factory.DisposableBean;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.beans.factory.ListableBeanFactory;
|
import org.springframework.beans.factory.ListableBeanFactory;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract exporter for JAX-WS services, autodetecting annotated service beans
|
* Abstract exporter for JAX-WS services, autodetecting annotated service beans
|
||||||
|
|
@ -99,26 +102,35 @@ public abstract class AbstractJaxWsServiceExporter implements BeanFactoryAware,
|
||||||
* @see #publishEndpoint
|
* @see #publishEndpoint
|
||||||
*/
|
*/
|
||||||
public void publishEndpoints() {
|
public void publishEndpoints() {
|
||||||
String[] beanNames = this.beanFactory.getBeanNamesForType(Object.class, false, false);
|
Set<String> beanNames = new LinkedHashSet<String>(this.beanFactory.getBeanDefinitionCount());
|
||||||
|
beanNames.addAll(Arrays.asList(this.beanFactory.getBeanDefinitionNames()));
|
||||||
|
if (this.beanFactory instanceof ConfigurableBeanFactory) {
|
||||||
|
beanNames.addAll(Arrays.asList(((ConfigurableBeanFactory) this.beanFactory).getSingletonNames()));
|
||||||
|
}
|
||||||
for (String beanName : beanNames) {
|
for (String beanName : beanNames) {
|
||||||
Class<?> type = this.beanFactory.getType(beanName);
|
try {
|
||||||
WebService wsAnnotation = type.getAnnotation(WebService.class);
|
Class<?> type = this.beanFactory.getType(beanName);
|
||||||
WebServiceProvider wsProviderAnnotation = type.getAnnotation(WebServiceProvider.class);
|
WebService wsAnnotation = type.getAnnotation(WebService.class);
|
||||||
if (wsAnnotation != null || wsProviderAnnotation != null) {
|
WebServiceProvider wsProviderAnnotation = type.getAnnotation(WebServiceProvider.class);
|
||||||
Endpoint endpoint = Endpoint.create(this.beanFactory.getBean(beanName));
|
if (wsAnnotation != null || wsProviderAnnotation != null) {
|
||||||
if (this.endpointProperties != null) {
|
Endpoint endpoint = Endpoint.create(this.beanFactory.getBean(beanName));
|
||||||
endpoint.setProperties(this.endpointProperties);
|
if (this.endpointProperties != null) {
|
||||||
|
endpoint.setProperties(this.endpointProperties);
|
||||||
|
}
|
||||||
|
if (this.executor != null) {
|
||||||
|
endpoint.setExecutor(this.executor);
|
||||||
|
}
|
||||||
|
if (wsAnnotation != null) {
|
||||||
|
publishEndpoint(endpoint, wsAnnotation);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
publishEndpoint(endpoint, wsProviderAnnotation);
|
||||||
|
}
|
||||||
|
this.publishedEndpoints.add(endpoint);
|
||||||
}
|
}
|
||||||
if (this.executor != null) {
|
}
|
||||||
endpoint.setExecutor(this.executor);
|
catch (CannotLoadBeanClassException ex) {
|
||||||
}
|
// ignore beans where the class is not resolvable
|
||||||
if (wsAnnotation != null) {
|
|
||||||
publishEndpoint(endpoint, wsAnnotation);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
publishEndpoint(endpoint, wsProviderAnnotation);
|
|
||||||
}
|
|
||||||
this.publishedEndpoints.add(endpoint);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue