Search in sources :

Example 1 with Qualifier

use of org.springframework.beans.factory.annotation.Qualifier in project jersey by jersey.

the class AutowiredInjectResolver method resolve.

@Override
public Object resolve(Injectee injectee) {
    AnnotatedElement parent = injectee.getParent();
    String beanName = null;
    if (parent != null) {
        Qualifier an = parent.getAnnotation(Qualifier.class);
        if (an != null) {
            beanName = an.value();
        }
    }
    boolean required = parent != null ? parent.getAnnotation(Autowired.class).required() : false;
    return getBeanFromSpringContext(beanName, injectee, required);
}
Also used : AnnotatedElement(java.lang.reflect.AnnotatedElement) Qualifier(org.springframework.beans.factory.annotation.Qualifier)

Example 2 with Qualifier

use of org.springframework.beans.factory.annotation.Qualifier in project pinpoint by naver.

the class HbaseTraceDao method setSpanMapper.

@Autowired
@Qualifier("spanMapper")
public void setSpanMapper(RowMapper<List<SpanBo>> spanMapper) {
    final Logger logger = LoggerFactory.getLogger(spanMapper.getClass());
    if (logger.isDebugEnabled()) {
        spanMapper = CellTraceMapper.wrap(spanMapper);
    }
    this.spanMapper = spanMapper;
}
Also used : Logger(org.slf4j.Logger) Autowired(org.springframework.beans.factory.annotation.Autowired) Qualifier(org.springframework.beans.factory.annotation.Qualifier)

Example 3 with Qualifier

use of org.springframework.beans.factory.annotation.Qualifier in project zipkin by openzipkin.

the class TraceZipkinElasticsearchHttpStorageAutoConfiguration method elasticsearchOkHttpClientBuilder.

@Bean
@Qualifier("zipkinElasticsearchHttp")
@ConditionalOnMissingBean
OkHttpClient.Builder elasticsearchOkHttpClientBuilder() {
    // have to indirect to unwind a circular dependency
    Interceptor tracingInterceptor = new Interceptor() {

        Interceptor delegate = BraveTracingInterceptor.builder(brave).serverName("elasticsearch").build();

        @Override
        public Response intercept(Chain chain) throws IOException {
            // Only join traces, don't start them. This prevents LocalCollector's thread from amplifying.
            if (brave.serverSpanThreadBinder().getCurrentServerSpan() != null && brave.serverSpanThreadBinder().getCurrentServerSpan().getSpan() != null) {
                return delegate.intercept(chain);
            }
            return chain.proceed(chain.request());
        }
    };
    BraveExecutorService tracePropagatingExecutor = BraveExecutorService.wrap(new Dispatcher().executorService(), brave);
    OkHttpClient.Builder builder = new OkHttpClient.Builder();
    builder.addInterceptor(tracingInterceptor);
    builder.addNetworkInterceptor(tracingInterceptor);
    builder.dispatcher(new Dispatcher(tracePropagatingExecutor));
    return builder;
}
Also used : BraveExecutorService(com.github.kristofa.brave.BraveExecutorService) OkHttpClient(okhttp3.OkHttpClient) Dispatcher(okhttp3.Dispatcher) Interceptor(okhttp3.Interceptor) BraveTracingInterceptor(com.github.kristofa.brave.okhttp.BraveTracingInterceptor) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Qualifier(org.springframework.beans.factory.annotation.Qualifier) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 4 with Qualifier

use of org.springframework.beans.factory.annotation.Qualifier in project uPortal by Jasig.

the class RenderingPipelineConfiguration method getPortalRenderingPipeline.

/**
 * This bean is the entry point into the uPortal Rendering Pipeline. It supports {@link
 * RenderingPipelineBranchPoint} beans, which are an extension point for adopters.
 */
@Bean(name = "portalRenderingPipeline")
@Qualifier(value = "main")
public IPortalRenderingPipeline getPortalRenderingPipeline() {
    // Rendering Pipeline Branches (adopter extension point)
    final List<RenderingPipelineBranchPoint> sortedList = (branchPoints != null) ? new LinkedList<>(branchPoints) : Collections.emptyList();
    Collections.sort(sortedList);
    final List<RenderingPipelineBranchPoint> branches = Collections.unmodifiableList(sortedList);
    /*
         * Sanity check:  if you have multiple RenderingPipelineBranchPoint beans, you can specify
         * an 'order' property on some or all of them to control the sequence of processing.
         * Having 2 RenderingPipelineBranchPoint beans with the same order value will produce
         * non-deterministic results and is a likely source of misconfiguration.
         */
    final Set<Integer> usedOderValues = new HashSet<>();
    boolean hasCollision = branches.stream().anyMatch(branchPoint -> {
        final boolean rslt = usedOderValues.contains(branchPoint.getOrder());
        usedOderValues.add(branchPoint.getOrder());
        return rslt;
    });
    if (hasCollision) {
        throw new RenderingPipelineConfigurationException("Multiple RenderingPipelineBranchPoint beans have the same 'order' value, which likely a misconfiguration");
    }
    // "Standard" Pipeline
    final IPortalRenderingPipeline standardRenderingPipeline = getStandardRenderingPipeline();
    return new IPortalRenderingPipeline() {

        @Override
        public void renderState(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
            for (RenderingPipelineBranchPoint branchPoint : branches) {
                if (branchPoint.renderStateIfApplicable(req, res)) {
                    /*
                         * Rendering bas been processed by the branch point -- no need to continue.
                         */
                    return;
                }
            }
            /*
                 * Reaching this point means that a branch was not followed; use the "standard"
                 * pipeline.
                 */
            standardRenderingPipeline.renderState(req, res);
        }
    };
}
Also used : IPortalRenderingPipeline(org.apereo.portal.rendering.IPortalRenderingPipeline) HttpServletRequest(javax.servlet.http.HttpServletRequest) RenderingPipelineBranchPoint(org.apereo.portal.rendering.RenderingPipelineBranchPoint) RenderingPipelineConfigurationException(org.apereo.portal.rendering.RenderingPipelineConfigurationException) HttpServletResponse(javax.servlet.http.HttpServletResponse) HashSet(java.util.HashSet) Qualifier(org.springframework.beans.factory.annotation.Qualifier) Bean(org.springframework.context.annotation.Bean)

Example 5 with Qualifier

use of org.springframework.beans.factory.annotation.Qualifier in project TeachingInSimulation by ScOrPiOzzy.

the class RMIConfig method buildLibraryPublishServiceFactory.

@Bean
@Qualifier("libraryPublishServiceFactory")
public RmiProxyFactoryBean buildLibraryPublishServiceFactory() {
    RmiProxyFactoryBean bean = new RmiProxyFactoryBean();
    bean.setServiceUrl("rmi://" + host + ":" + port + "/libraryPublishService");
    LOG.info("远程访问路径:{}", bean.getServiceUrl());
    bean.setServiceInterface(LibraryPublishService.class);
    return bean;
}
Also used : RmiProxyFactoryBean(org.springframework.remoting.rmi.RmiProxyFactoryBean) Qualifier(org.springframework.beans.factory.annotation.Qualifier) RmiProxyFactoryBean(org.springframework.remoting.rmi.RmiProxyFactoryBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

Qualifier (org.springframework.beans.factory.annotation.Qualifier)65 Bean (org.springframework.context.annotation.Bean)58 RmiProxyFactoryBean (org.springframework.remoting.rmi.RmiProxyFactoryBean)18 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)12 Configuration (org.springframework.context.annotation.Configuration)7 EnableConfigurationProperties (org.springframework.boot.context.properties.EnableConfigurationProperties)6 lombok.val (lombok.val)5 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)5 ConfigurationProperties (org.springframework.boot.context.properties.ConfigurationProperties)5 RequestResponseClientConfigProperties (org.eclipse.hono.client.RequestResponseClientConfigProperties)4 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)4 ScopedProxyMode (org.springframework.context.annotation.ScopedProxyMode)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 ClientFactoryBuilder (com.linecorp.armeria.client.ClientFactoryBuilder)2 IdMCacheConfiguration (eu.bcvsolutions.idm.core.api.config.cache.IdMCacheConfiguration)2 Supplier (java.util.function.Supplier)2