parent
6ea6adb10e
commit
0f0c6e0729
|
|
@ -37,7 +37,6 @@ import org.springframework.context.annotation.Configuration;
|
||||||
* {@link Configuration Auto-configuration} for {@link CacheMeterBinderProvider} beans.
|
* {@link Configuration Auto-configuration} for {@link CacheMeterBinderProvider} beans.
|
||||||
*
|
*
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @since 2.0.0
|
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnClass(MeterBinder.class)
|
@ConditionalOnClass(MeterBinder.class)
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ import org.springframework.util.StringUtils;
|
||||||
* caches}.
|
* caches}.
|
||||||
*
|
*
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @since 2.0.0
|
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnBean(CacheMeterBinderProvider.class)
|
@ConditionalOnBean(CacheMeterBinderProvider.class)
|
||||||
|
|
@ -59,8 +58,8 @@ class CacheMetricsRegistrarConfiguration {
|
||||||
Collection<CacheMeterBinderProvider<?>> binderProviders,
|
Collection<CacheMeterBinderProvider<?>> binderProviders,
|
||||||
Map<String, CacheManager> cacheManagers) {
|
Map<String, CacheManager> cacheManagers) {
|
||||||
this.registry = registry;
|
this.registry = registry;
|
||||||
this.binderProviders = binderProviders;
|
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
|
this.binderProviders = binderProviders;
|
||||||
this.cacheManagers = cacheManagers;
|
this.cacheManagers = cacheManagers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,12 @@ public class CacheMetricsConfigurationTests {
|
||||||
|
|
||||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||||
.withUserConfiguration(RegistryConfiguration.class)
|
.withUserConfiguration(RegistryConfiguration.class)
|
||||||
.withConfiguration(AutoConfigurations.of(MetricsAutoConfiguration.class))
|
.withConfiguration(AutoConfigurations.of(MetricsAutoConfiguration.class, CacheAutoConfiguration.class))
|
||||||
.withPropertyValues("management.metrics.use-global-registry=false");
|
.withPropertyValues("management.metrics.use-global-registry=false");
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void autoConfiguredCacheManagerIsInstrumented() {
|
public void autoConfiguredCacheManagerIsInstrumented() {
|
||||||
this.contextRunner
|
this.contextRunner
|
||||||
.withConfiguration(AutoConfigurations.of(CacheAutoConfiguration.class))
|
|
||||||
.withPropertyValues("spring.cache.type=caffeine",
|
.withPropertyValues("spring.cache.type=caffeine",
|
||||||
"spring.cache.cache-names=cache1,cache2")
|
"spring.cache.cache-names=cache1,cache2")
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
|
|
@ -60,7 +59,6 @@ public class CacheMetricsConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
public void autoConfiguredCacheManagerWithCustomMetricName() {
|
public void autoConfiguredCacheManagerWithCustomMetricName() {
|
||||||
this.contextRunner
|
this.contextRunner
|
||||||
.withConfiguration(AutoConfigurations.of(CacheAutoConfiguration.class))
|
|
||||||
.withPropertyValues(
|
.withPropertyValues(
|
||||||
"management.metrics.cache.cache-metric-name=custom.name",
|
"management.metrics.cache.cache-metric-name=custom.name",
|
||||||
"spring.cache.type=caffeine", "spring.cache.cache-names=cache1")
|
"spring.cache.type=caffeine", "spring.cache.cache-names=cache1")
|
||||||
|
|
@ -76,7 +74,6 @@ public class CacheMetricsConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
public void autoConfiguredNonSupportedCacheManagerIsIgnored() {
|
public void autoConfiguredNonSupportedCacheManagerIsIgnored() {
|
||||||
this.contextRunner
|
this.contextRunner
|
||||||
.withConfiguration(AutoConfigurations.of(CacheAutoConfiguration.class))
|
|
||||||
.withPropertyValues("spring.cache.type=simple",
|
.withPropertyValues("spring.cache.type=simple",
|
||||||
"spring.cache.cache-names=cache1,cache2")
|
"spring.cache.cache-names=cache1,cache2")
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
|
|
@ -91,7 +88,6 @@ public class CacheMetricsConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
public void cacheInstrumentationCanBeDisabled() {
|
public void cacheInstrumentationCanBeDisabled() {
|
||||||
this.contextRunner
|
this.contextRunner
|
||||||
.withConfiguration(AutoConfigurations.of(CacheAutoConfiguration.class))
|
|
||||||
.withPropertyValues("management.metrics.cache.instrument-cache=false",
|
.withPropertyValues("management.metrics.cache.instrument-cache=false",
|
||||||
"spring.cache.type=caffeine", "spring.cache.cache-names=cache1")
|
"spring.cache.type=caffeine", "spring.cache.cache-names=cache1")
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2017 the original author or authors.
|
* Copyright 2012-2018 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.
|
||||||
|
|
@ -63,7 +63,7 @@ import org.springframework.util.StringUtils;
|
||||||
public abstract class AnnotationEndpointDiscoverer<K, T extends Operation>
|
public abstract class AnnotationEndpointDiscoverer<K, T extends Operation>
|
||||||
implements EndpointDiscoverer<T> {
|
implements EndpointDiscoverer<T> {
|
||||||
|
|
||||||
private final Log logger = LogFactory.getLog(getClass());
|
private static final Log logger = LogFactory.getLog(AnnotationEndpointDiscoverer.class);
|
||||||
|
|
||||||
private final ApplicationContext applicationContext;
|
private final ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
|
@ -277,10 +277,10 @@ public abstract class AnnotationEndpointDiscoverer<K, T extends Operation>
|
||||||
catch (ClassCastException ex) {
|
catch (ClassCastException ex) {
|
||||||
String msg = ex.getMessage();
|
String msg = ex.getMessage();
|
||||||
if (msg == null || msg.startsWith(endpointInfo.getClass().getName())) {
|
if (msg == null || msg.startsWith(endpointInfo.getClass().getName())) {
|
||||||
// Possibly a lambda-defined listener which we could not resolve the
|
// Possibly a lambda-defined EndpointFilter which we could not resolve the
|
||||||
// generic event type for
|
// generic EndpointInfo type for
|
||||||
if (this.logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
this.logger.debug("Non-matching info type for filter: " + filter, ex);
|
logger.debug("Non-matching EndpointInfo for EndpointFilter: " + filter, ex);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ import org.springframework.core.ResolvableType;
|
||||||
*/
|
*/
|
||||||
public class CacheMetricsRegistrar {
|
public class CacheMetricsRegistrar {
|
||||||
|
|
||||||
|
private static final Log logger = LogFactory.getLog(CacheMetricsRegistrar.class);
|
||||||
|
|
||||||
private final MeterRegistry registry;
|
private final MeterRegistry registry;
|
||||||
|
|
||||||
private final String metricName;
|
private final String metricName;
|
||||||
|
|
@ -94,12 +96,11 @@ public class CacheMetricsRegistrar {
|
||||||
catch (ClassCastException ex) {
|
catch (ClassCastException ex) {
|
||||||
String msg = ex.getMessage();
|
String msg = ex.getMessage();
|
||||||
if (msg == null || msg.startsWith(cache.getClass().getName())) {
|
if (msg == null || msg.startsWith(cache.getClass().getName())) {
|
||||||
// Possibly a lambda-defined listener which we could not resolve
|
// Possibly a lambda-defined CacheMeterBinderProvider which we could not resolve
|
||||||
// the generic event type for
|
// the generic Cache type for
|
||||||
Log logger = LogFactory.getLog(getClass());
|
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Non-matching event type for CacheMeterBinderProvider: "
|
"Non-matching Cache type for CacheMeterBinderProvider: "
|
||||||
+ binderProvider,
|
+ binderProvider,
|
||||||
ex);
|
ex);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ public class ServerProperties {
|
||||||
*/
|
*/
|
||||||
private Duration connectionTimeout;
|
private Duration connectionTimeout;
|
||||||
|
|
||||||
private Session session = new Session();
|
private final Session session = new Session();
|
||||||
|
|
||||||
@NestedConfigurationProperty
|
@NestedConfigurationProperty
|
||||||
private Ssl ssl;
|
private Ssl ssl;
|
||||||
|
|
@ -109,7 +109,7 @@ public class ServerProperties {
|
||||||
@NestedConfigurationProperty
|
@NestedConfigurationProperty
|
||||||
private final Http2 http2 = new Http2();
|
private final Http2 http2 = new Http2();
|
||||||
|
|
||||||
private Servlet servlet = new Servlet();
|
private final Servlet servlet = new Servlet();
|
||||||
|
|
||||||
private final Tomcat tomcat = new Tomcat();
|
private final Tomcat tomcat = new Tomcat();
|
||||||
|
|
||||||
|
|
@ -181,10 +181,6 @@ public class ServerProperties {
|
||||||
return this.session;
|
return this.session;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSession(Session session) {
|
|
||||||
this.session = session;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Ssl getSsl() {
|
public Ssl getSsl() {
|
||||||
return this.ssl;
|
return this.ssl;
|
||||||
}
|
}
|
||||||
|
|
@ -205,10 +201,6 @@ public class ServerProperties {
|
||||||
return this.servlet;
|
return this.servlet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setServlet(Servlet servlet) {
|
|
||||||
this.servlet = servlet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Tomcat getTomcat() {
|
public Tomcat getTomcat() {
|
||||||
return this.tomcat;
|
return this.tomcat;
|
||||||
}
|
}
|
||||||
|
|
@ -242,7 +234,7 @@ public class ServerProperties {
|
||||||
private String path = "/";
|
private String path = "/";
|
||||||
|
|
||||||
@NestedConfigurationProperty
|
@NestedConfigurationProperty
|
||||||
private Jsp jsp = new Jsp();
|
private final Jsp jsp = new Jsp();
|
||||||
|
|
||||||
public String getContextPath() {
|
public String getContextPath() {
|
||||||
return this.contextPath;
|
return this.contextPath;
|
||||||
|
|
@ -276,10 +268,6 @@ public class ServerProperties {
|
||||||
return this.jsp;
|
return this.jsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJsp(Jsp jsp) {
|
|
||||||
this.jsp = jsp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getServletMapping() {
|
public String getServletMapping() {
|
||||||
if (this.path.equals("") || this.path.equals("/")) {
|
if (this.path.equals("") || this.path.equals("/")) {
|
||||||
return "/";
|
return "/";
|
||||||
|
|
@ -359,7 +347,7 @@ public class ServerProperties {
|
||||||
*/
|
*/
|
||||||
private File storeDir;
|
private File storeDir;
|
||||||
|
|
||||||
private Cookie cookie = new Cookie();
|
private final Cookie cookie = new Cookie();
|
||||||
|
|
||||||
public Cookie getCookie() {
|
public Cookie getCookie() {
|
||||||
return this.cookie;
|
return this.cookie;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2017 the original author or authors.
|
* Copyright 2012-2018 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.
|
||||||
|
|
@ -45,6 +45,8 @@ import org.springframework.util.Assert;
|
||||||
public class WebServerFactoryCustomizerBeanPostProcessor
|
public class WebServerFactoryCustomizerBeanPostProcessor
|
||||||
implements BeanPostProcessor, BeanFactoryAware {
|
implements BeanPostProcessor, BeanFactoryAware {
|
||||||
|
|
||||||
|
private static final Log logger = LogFactory.getLog(WebServerFactoryCustomizerBeanPostProcessor.class);
|
||||||
|
|
||||||
private ListableBeanFactory beanFactory;
|
private ListableBeanFactory beanFactory;
|
||||||
|
|
||||||
private List<WebServerFactoryCustomizer<?>> customizers;
|
private List<WebServerFactoryCustomizer<?>> customizers;
|
||||||
|
|
@ -92,8 +94,8 @@ public class WebServerFactoryCustomizerBeanPostProcessor
|
||||||
catch (ClassCastException ex) {
|
catch (ClassCastException ex) {
|
||||||
String msg = ex.getMessage();
|
String msg = ex.getMessage();
|
||||||
if (msg == null || msg.startsWith(webServerFactory.getClass().getName())) {
|
if (msg == null || msg.startsWith(webServerFactory.getClass().getName())) {
|
||||||
// Possibly a lambda-defined listener which we could not resolve the
|
// Possibly a lambda-defined WebServerFactoryCustomizer which we could not resolve the
|
||||||
// generic event type for
|
// generic WebServerFactory type for
|
||||||
logLambdaDebug(customizer, ex);
|
logLambdaDebug(customizer, ex);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -104,9 +106,8 @@ public class WebServerFactoryCustomizerBeanPostProcessor
|
||||||
|
|
||||||
private void logLambdaDebug(WebServerFactoryCustomizer<?> customizer,
|
private void logLambdaDebug(WebServerFactoryCustomizer<?> customizer,
|
||||||
ClassCastException ex) {
|
ClassCastException ex) {
|
||||||
Log logger = LogFactory.getLog(getClass());
|
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Non-matching factory type for customizer: " + customizer, ex);
|
logger.debug("Non-matching WebServerFactory type for WebServerFactoryCustomizer: " + customizer, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2017 the original author or authors.
|
* Copyright 2012-2018 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.
|
||||||
|
|
@ -403,11 +403,10 @@ public class SysVinitLaunchScriptIT {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void execute(CopyToContainerCmd command) {
|
protected Void execute(CopyToContainerCmd command) {
|
||||||
try {
|
try (InputStream streamToUpload = new FileInputStream(CompressArchiveUtil
|
||||||
InputStream streamToUpload = new FileInputStream(CompressArchiveUtil
|
.archiveTARFiles(command.getFile().getParentFile(),
|
||||||
.archiveTARFiles(command.getFile().getParentFile(),
|
Arrays.asList(command.getFile()),
|
||||||
Arrays.asList(command.getFile()),
|
command.getFile().getName()))) {
|
||||||
command.getFile().getName()));
|
|
||||||
WebTarget webResource = getBaseResource().path("/containers/{id}/archive")
|
WebTarget webResource = getBaseResource().path("/containers/{id}/archive")
|
||||||
.resolveTemplate("id", command.getContainer());
|
.resolveTemplate("id", command.getContainer());
|
||||||
webResource.queryParam("path", ".")
|
webResource.queryParam("path", ".")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue