Skip to content

Commit

Permalink
Merge branch '2.1.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkinsona committed Feb 21, 2019
2 parents 3d03c01 + 5332669 commit f2e3e27
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand All @@ -20,6 +20,7 @@
import java.util.Map;

import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceException;

import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.jpa.HibernateMetrics;
Expand Down Expand Up @@ -65,8 +66,14 @@ public void bindEntityManagerFactoriesToRegistry(
private void bindEntityManagerFactoryToRegistry(String beanName,
EntityManagerFactory entityManagerFactory, MeterRegistry registry) {
String entityManagerFactoryName = getEntityManagerFactoryName(beanName);
new HibernateMetrics(entityManagerFactory, entityManagerFactoryName,
Collections.emptyList()).bindTo(registry);
try {
new HibernateMetrics(entityManagerFactory.unwrap(SessionFactory.class),
entityManagerFactoryName, Collections.emptyList())
.bindTo(registry);
}
catch (PersistenceException ex) {
// Continue
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void actuatorEndpointsWhenUserProvidedResourceConfigBeanNotAvailable() {
testJerseyEndpoints(new Class[] { EndpointsConfiguration.class });
}

protected void testJerseyEndpoints(Class[] userConfigurations) {
protected void testJerseyEndpoints(Class<?>[] userConfigurations) {
FilteredClassLoader classLoader = new FilteredClassLoader(
DispatcherServlet.class);
new WebApplicationContextRunner(
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -77,9 +77,7 @@ MeterBinder testBinder(Alpha thing) {

@Bean
MeterRegistryCustomizer<?> testCustomizer() {
return (registry) -> {
registry.config().commonTags("testTag", "testValue");
};
return (registry) -> registry.config().commonTags("testTag", "testValue");
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public void elasticsearchIsUp() throws IOException {
}

@Test
@SuppressWarnings("unchecked")
public void elasticsearchWithYellowStatusIsUp() throws IOException {
given(this.jestClient.execute(any(Action.class)))
.willReturn(createJestResult(200, true, "yellow"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ protected Mono<ServerResponse> renderErrorView(ServerRequest request) {
protected Mono<ServerResponse> renderErrorResponse(ServerRequest request) {
boolean includeStackTrace = isIncludeStackTrace(request, MediaType.ALL);
Map<String, Object> error = getErrorAttributes(request, includeStackTrace);
HttpStatus errorStatus = getHttpStatus(error);
return ServerResponse.status(getHttpStatus(error))
.contentType(MediaType.APPLICATION_JSON_UTF8)
.body(BodyInserters.fromObject(error));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,8 @@ public void existingMessageSourceInParentIsIgnored() {
public void messageSourceWithNonStandardBeanNameIsIgnored() {
this.contextRunner.withPropertyValues("spring.messages.basename:test/messages")
.withUserConfiguration(CustomBeanNameMessageSourceConfiguration.class)
.run((context) -> {
assertThat(context.getMessage("foo", null, Locale.US))
.isEqualTo("bar");
});
.run((context) -> assertThat(context.getMessage("foo", null, Locale.US))
.isEqualTo("bar"));
}

@Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,8 @@ static class DownloadConfigBuilderCustomizerConfiguration {

@Bean
public DownloadConfigBuilderCustomizer testDownloadConfigBuilderCustomizer() {
return (downloadConfigBuilder) -> {
downloadConfigBuilder.userAgent("Test User Agent");
};
return (downloadConfigBuilder) -> downloadConfigBuilder
.userAgent("Test User Agent");
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -307,7 +307,6 @@ public void call(SourceUnit source, GeneratorContext context, ClassNode classNod

private static class MainClass {

@SuppressWarnings("unchecked")
public static ClassNode get(CompilationUnit source) {
return get(source.getAST().getClasses());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,9 @@ public void runWithFailedContextShouldReturnFailedAssertableContext() {
@Test
public void runWithClassLoaderShouldSetClassLoaderOnContext() {
get().withClassLoader(new FilteredClassLoader(Gson.class.getPackage().getName()))
.run((context) -> {
assertThatExceptionOfType(ClassNotFoundException.class)
.isThrownBy(() -> {
ClassUtils.forName(Gson.class.getName(),
context.getClassLoader());
});
});
.run((context) -> assertThatExceptionOfType(ClassNotFoundException.class)
.isThrownBy(() -> ClassUtils.forName(Gson.class.getName(),
context.getClassLoader())));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ private List<ConfigurationTable> createConfigTables(
List<String> matchingOverrides = overrides.keySet().stream()
.filter((overrideKey) -> overrideKey.startsWith(keyPrefix))
.collect(Collectors.toList());
matchingOverrides.forEach((match) -> {
table.addEntry(overrides.remove(match));
});
matchingOverrides.forEach((match) ->
table.addEntry(overrides.remove(match)));
}
List<String> matchingKeys = unmappedKeys.stream()
.filter((key) -> keyPrefixes.stream().anyMatch(key::startsWith))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
/**
* A base properties class with generics.
*
* @param <A> name type
* @param <B> mapping key type
* @param <C> mapping value type
* @author Stephane Nicoll
*/
public class AbstractGenericProperties<A, B, C> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/**
* An intermediate layer that resolves some of the generics from the parent but not all.
*
* @param <C> mapping value type
* @author Stephane Nicoll
*/
public abstract class AbstractIntermediateGenericProperties<C>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
/**
* Properties with unresolved generic information.
*
* @param <B> mapping key type
* @param <C> mapping value type
* @author Stephane Nicoll
*/
@ConfigurationProperties("generic")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ public BootJar() {
getMainSpec().with(this.bootInf);
this.bootInf.into("classes", classpathFiles(File::isDirectory));
this.bootInf.into("lib", classpathFiles(File::isFile));
this.bootInf.filesMatching("module-info.class", (details) -> {
details.setRelativePath(details.getRelativeSourcePath());
});
this.bootInf.filesMatching("module-info.class",
(details) -> details.setRelativePath(details.getRelativeSourcePath()));
getRootSpec().eachFile((details) -> {
String pathString = details.getRelativePath().getPathString();
if (pathString.startsWith("BOOT-INF/lib/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ public BootWar() {
(copySpec) -> copySpec.from(
(Callable<Iterable<File>>) () -> (this.providedClasspath != null)
? this.providedClasspath : Collections.emptyList()));
getRootSpec().filesMatching("module-info.class", (details) -> {
details.setRelativePath(details.getRelativeSourcePath());
});
getRootSpec().filesMatching("module-info.class",
(details) -> details.setRelativePath(details.getRelativeSourcePath()));
getRootSpec().eachFile((details) -> {
String pathString = details.getRelativePath().getPathString();
if ((pathString.startsWith("WEB-INF/lib/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
* @since 1.0
* @deprecated since version 2.2. Use agents instead.
*/
@Deprecated
@Parameter(property = "spring-boot.run.agent")
private File[] agent;

Expand Down Expand Up @@ -384,7 +385,6 @@ private void addAgents(List<String> args) {
}
}

@SuppressWarnings("deprecation")
private File[] determineAgents() {
return (this.agents != null) ? this.agents : this.agent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ public String toString() {
* @return a {@link LogFile} or {@code null} if the environment didn't contain any
* suitable properties
*/
@SuppressWarnings("deprecation")
public static LogFile get(PropertyResolver propertyResolver) {
String file = getLogFileProperty(propertyResolver, FILE_NAME_PROPERTY,
FILE_PROPERTY);
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,7 +38,7 @@ public class DefaultApplicationArgumentsTests {
@Test
public void argumentsMustNotBeNull() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new DefaultApplicationArguments(null))
.isThrownBy(() -> new DefaultApplicationArguments((String[]) null))
.withMessageContaining("Args must not be null");
}

Expand Down

0 comments on commit f2e3e27

Please sign in to comment.