org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate Java Examples
The following examples show how to use
org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JdbcTemplateAutoConfiguration.java From sqlhelper with GNU Lesser General Public License v3.0 | 5 votes |
@Bean @Primary @ConditionalOnSingleCandidate(JdbcTemplate.class) @ConditionalOnMissingBean(NamedParameterJdbcOperations.class) public NamedParameterJdbcTemplate namedParameterJdbcTemplate(JdbcTemplate jdbcTemplate) { return new NamedParameterJdbcTemplate(jdbcTemplate); }
Example #2
Source File: ActuatorInfoAutoConfiguration.java From spring-cloud-formula with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnEnabledInfoContributor("launcher") @ConditionalOnSingleCandidate(LauncherInfoProperties.class) @ConditionalOnMissingBean @Order(DEFAULT_ORDER) public LauncherInfoContributor launcherInfoContributor(LauncherInfoProperties properties) { return new LauncherInfoContributor(properties, this.properties.getLauncher().getMode()); }
Example #3
Source File: EclairAutoConfiguration.java From eclair with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnSingleCandidate(Jaxb2Marshaller.class) @ConditionalOnMissingBean(Jaxb2Printer.class) @Order(100) public Printer jaxb2Printer(ObjectProvider<Jaxb2Marshaller> jaxb2Marshaller) { Jaxb2Marshaller marshaller = jaxb2Marshaller.getObject(); return new Jaxb2Printer(marshaller) .addPreProcessor(new JaxbElementWrapper(marshaller)); }
Example #4
Source File: EclairAutoConfiguration.java From eclair with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnSingleCandidate(ObjectMapper.class) @ConditionalOnMissingBean @Order(200) public JacksonPrinter jacksonPrinter(ObjectProvider<ObjectMapper> objectMapper) { return new JacksonPrinter(objectMapper.getObject()); }
Example #5
Source File: QuickFixJClientAutoConfiguration.java From quickfixj-spring-boot-starter with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnProperty(prefix = "quickfixj.client", name = "jmx-enabled", havingValue = "true") @ConditionalOnClass(JmxExporter.class) @ConditionalOnSingleCandidate(Initiator.class) @ConditionalOnMissingBean(name = "clientInitiatorMBean", value = ObjectName.class) public ObjectName clientInitiatorMBean(Initiator clientInitiator) { try { JmxExporter exporter = new JmxExporter(); exporter.setRegistrationBehavior(REGISTRATION_REPLACE_EXISTING); return exporter.register(clientInitiator); } catch (Exception e) { throw new ConfigurationException(e.getMessage(), e); } }
Example #6
Source File: QuickFixJServerAutoConfiguration.java From quickfixj-spring-boot-starter with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnProperty(prefix = "quickfixj.server", name = "jmx-enabled", havingValue = "true") @ConditionalOnClass(JmxExporter.class) @ConditionalOnSingleCandidate(Acceptor.class) @ConditionalOnMissingBean(name = "serverAcceptorMBean") public ObjectName serverAcceptorMBean(Acceptor serverAcceptor) { try { JmxExporter exporter = new JmxExporter(); exporter.setRegistrationBehavior(REGISTRATION_REPLACE_EXISTING); return exporter.register(serverAcceptor); } catch (Exception e) { throw new ConfigurationException(e.getMessage(), e); } }
Example #7
Source File: OpenTracingProxyAutoConfiguration.java From opentracing-toolbox with MIT License | 5 votes |
@API(status = INTERNAL) @Bean @Primary @ConditionalOnSingleCandidate(Tracer.class) public Tracer proxyTracer( final Tracer tracer, final List<Plugin> plugins) { return reduce(plugins, new ProxyTracer(tracer), ProxyTracer::with); }
Example #8
Source File: RabbitAutoConfiguration.java From summerframework with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnSingleCandidate(RabbitTemplate.class) public RabbitMessagingTemplate rabbitMessagingTemplate(RabbitTemplate rabbitTemplate) { return new RabbitMessagingTemplate(rabbitTemplate); }
Example #9
Source File: GrpcClientSecurityAutoConfiguration.java From grpc-spring-boot-starter with MIT License | 2 votes |
/** * Creates a {@link StubTransformer} bean that will add the call credentials to the created stubs. * * <p> * <b>Note:</b> This method will only be applied if exactly one {@link CallCredentials} is in the application * context. * </p> * * @param credentials The call credentials to configure in the stubs. * @return The StubTransformer bean that will add the given credentials. * @see AbstractStub#withCallCredentials(CallCredentials) * @sse {@link CallCredentialsHelper#fixedCredentialsStubTransformer(CallCredentials)} */ @ConditionalOnSingleCandidate(CallCredentials.class) @Bean StubTransformer stubCallCredentialsTransformer(final CallCredentials credentials) { return CallCredentialsHelper.fixedCredentialsStubTransformer(credentials); }
Example #10
Source File: GrpcClientSecurityAutoConfiguration.java From grpc-spring-boot-starter with MIT License | 2 votes |
/** * Creates a {@link StubTransformer} bean that will add the call credentials to the created stubs. * * <p> * <b>Note:</b> This method will only be applied if exactly one {@link CallCredentials} is in the application * context. * </p> * * @param credentials The call credentials to configure in the stubs. * @return The StubTransformer bean that will add the given credentials. * @see AbstractStub#withCallCredentials(CallCredentials) * @sse {@link CallCredentialsHelper#fixedCredentialsStubTransformer(CallCredentials)} */ @ConditionalOnSingleCandidate(CallCredentials.class) @Bean StubTransformer stubCallCredentialsTransformer(final CallCredentials credentials) { return CallCredentialsHelper.fixedCredentialsStubTransformer(credentials); }