Merge pull request #15775 from Johnny Lim
* gh-15775: Polish "Use class for @ConditionalOnClass" Use class for @ConditionalOnClass Closes gh-15775
This commit is contained in:
commit
d368e9c6eb
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2017 the original author or authors.
|
* Copyright 2012-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -54,7 +54,7 @@ class BatchConfigurerConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnClass(name = "javax.persistence.EntityManagerFactory")
|
@ConditionalOnClass(EntityManagerFactory.class)
|
||||||
@ConditionalOnBean(name = "entityManagerFactory")
|
@ConditionalOnBean(name = "entityManagerFactory")
|
||||||
static class JpaBatchConfiguration {
|
static class JpaBatchConfiguration {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2018 the original author or authors.
|
* Copyright 2012-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -75,7 +75,7 @@ class DataSourceJmxConfiguration {
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnProperty(prefix = "spring.datasource", name = "jmx-enabled")
|
@ConditionalOnProperty(prefix = "spring.datasource", name = "jmx-enabled")
|
||||||
@ConditionalOnClass(name = "org.apache.tomcat.jdbc.pool.DataSourceProxy")
|
@ConditionalOnClass(DataSourceProxy.class)
|
||||||
@ConditionalOnSingleCandidate(DataSource.class)
|
@ConditionalOnSingleCandidate(DataSource.class)
|
||||||
static class TomcatDataSourceJmxConfiguration {
|
static class TomcatDataSourceJmxConfiguration {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2018 the original author or authors.
|
* Copyright 2012-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -34,6 +34,7 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.glassfish.jersey.jackson.JacksonFeature;
|
import org.glassfish.jersey.jackson.JacksonFeature;
|
||||||
import org.glassfish.jersey.server.ResourceConfig;
|
import org.glassfish.jersey.server.ResourceConfig;
|
||||||
|
import org.glassfish.jersey.server.spring.SpringComponentProvider;
|
||||||
import org.glassfish.jersey.servlet.ServletContainer;
|
import org.glassfish.jersey.servlet.ServletContainer;
|
||||||
import org.glassfish.jersey.servlet.ServletProperties;
|
import org.glassfish.jersey.servlet.ServletProperties;
|
||||||
|
|
||||||
|
@ -76,8 +77,7 @@ import org.springframework.web.filter.RequestContextFilter;
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnClass(name = { "org.glassfish.jersey.server.spring.SpringComponentProvider",
|
@ConditionalOnClass({ SpringComponentProvider.class, ServletRegistration.class })
|
||||||
"javax.servlet.ServletRegistration" })
|
|
||||||
@ConditionalOnBean(type = "org.glassfish.jersey.server.ResourceConfig")
|
@ConditionalOnBean(type = "org.glassfish.jersey.server.ResourceConfig")
|
||||||
@ConditionalOnWebApplication(type = Type.SERVLET)
|
@ConditionalOnWebApplication(type = Type.SERVLET)
|
||||||
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
|
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.springframework.context.annotation.Configuration;
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnClass(name = ArtemisConnectionFactoryFactory.EMBEDDED_JMS_CLASS)
|
@ConditionalOnClass(EmbeddedJMS.class)
|
||||||
@ConditionalOnProperty(prefix = "spring.artemis.embedded", name = "enabled", havingValue = "true", matchIfMissing = true)
|
@ConditionalOnProperty(prefix = "spring.artemis.embedded", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||||
class ArtemisEmbeddedServerConfiguration {
|
class ArtemisEmbeddedServerConfiguration {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2018 the original author or authors.
|
* Copyright 2012-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -307,7 +307,7 @@ public class ThymeleafAutoConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnClass(name = "nz.net.ultraq.thymeleaf.LayoutDialect")
|
@ConditionalOnClass(LayoutDialect.class)
|
||||||
protected static class ThymeleafWebLayoutConfiguration {
|
protected static class ThymeleafWebLayoutConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2018 the original author or authors.
|
* Copyright 2012-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -20,6 +20,7 @@ import javax.servlet.Servlet;
|
||||||
import javax.websocket.server.ServerContainer;
|
import javax.websocket.server.ServerContainer;
|
||||||
|
|
||||||
import org.apache.catalina.startup.Tomcat;
|
import org.apache.catalina.startup.Tomcat;
|
||||||
|
import org.apache.tomcat.websocket.server.WsSci;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
|
@ -47,7 +48,7 @@ import org.springframework.context.annotation.Configuration;
|
||||||
public class WebSocketReactiveAutoConfiguration {
|
public class WebSocketReactiveAutoConfiguration {
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnClass(name = "org.apache.tomcat.websocket.server.WsSci", value = Tomcat.class)
|
@ConditionalOnClass({ Tomcat.class, WsSci.class })
|
||||||
static class TomcatWebSocketConfiguration {
|
static class TomcatWebSocketConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2018 the original author or authors.
|
* Copyright 2012-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -20,6 +20,7 @@ import javax.servlet.Servlet;
|
||||||
import javax.websocket.server.ServerContainer;
|
import javax.websocket.server.ServerContainer;
|
||||||
|
|
||||||
import org.apache.catalina.startup.Tomcat;
|
import org.apache.catalina.startup.Tomcat;
|
||||||
|
import org.apache.tomcat.websocket.server.WsSci;
|
||||||
import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer;
|
import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||||
|
@ -58,7 +59,7 @@ import org.springframework.context.annotation.Configuration;
|
||||||
public class WebSocketServletAutoConfiguration {
|
public class WebSocketServletAutoConfiguration {
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnClass(name = "org.apache.tomcat.websocket.server.WsSci", value = Tomcat.class)
|
@ConditionalOnClass({ Tomcat.class, WsSci.class })
|
||||||
static class TomcatWebSocketConfiguration {
|
static class TomcatWebSocketConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
Loading…
Reference in New Issue