pull/3692/head
Phillip Webb 9 years ago
parent 3ff878a94b
commit 8d92236eea

@ -213,6 +213,7 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator implement
return super.matchesProduct(product) return super.matchesProduct(product)
|| product.toLowerCase().startsWith("firebird"); || product.toLowerCase().startsWith("firebird");
} }
}; };
private final String product; private final String product;

@ -23,7 +23,8 @@ import org.springframework.context.annotation.Configuration;
/** /**
* {@link EnableAutoConfiguration Auto-configuration} for {@link ConfigurationProperties} * {@link EnableAutoConfiguration Auto-configuration} for {@link ConfigurationProperties}
* beans. Automatically binds and validates any bean annotated with {@code @ConfigurationProperties}. * beans. Automatically binds and validates any bean annotated with
* {@code @ConfigurationProperties}.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 1.3.0 * @since 1.3.0

@ -55,9 +55,9 @@ public class H2ConsoleAutoConfiguration {
@Bean @Bean
public ServletRegistrationBean h2Console() { public ServletRegistrationBean h2Console() {
return new ServletRegistrationBean(new WebServlet(), this.properties.getPath() String path = this.properties.getPath();
.endsWith("/") ? this.properties.getPath() + "*" String urlMapping = (path.endsWith("/") ? path + "*" : path + "/*");
: this.properties.getPath() + "/*"); return new ServletRegistrationBean(new WebServlet(), urlMapping);
} }
@Configuration @Configuration
@ -83,9 +83,9 @@ public class H2ConsoleAutoConfiguration {
@Override @Override
public void configure(HttpSecurity http) throws Exception { public void configure(HttpSecurity http) throws Exception {
HttpSecurity h2Console = http.antMatcher(this.console.getPath().endsWith( String path = this.console.getPath();
"/") ? this.console.getPath() + "**" : this.console.getPath() String antPattern = (path.endsWith("/") ? path + "**" : path + "/**");
+ "/**"); HttpSecurity h2Console = http.antMatcher(antPattern);
h2Console.csrf().disable(); h2Console.csrf().disable();
h2Console.httpBasic(); h2Console.httpBasic();
h2Console.headers().frameOptions().sameOrigin(); h2Console.headers().frameOptions().sameOrigin();

@ -777,7 +777,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
} }
public boolean isEnabled() { public boolean isEnabled() {
return enabled; return this.enabled;
} }
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
@ -785,7 +785,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
} }
public String getPattern() { public String getPattern() {
return pattern; return this.pattern;
} }
public void setPattern(String pattern) { public void setPattern(String pattern) {
@ -793,7 +793,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
} }
public String getDirectory() { public String getDirectory() {
return directory; return this.directory;
} }
public void setDirectory(String directory) { public void setDirectory(String directory) {
@ -801,7 +801,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
} }
public String getPrefix() { public String getPrefix() {
return prefix; return this.prefix;
} }
public void setPrefix(String prefix) { public void setPrefix(String prefix) {
@ -809,7 +809,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
} }
public String getSuffix() { public String getSuffix() {
return suffix; return this.suffix;
} }
public void setSuffix(String suffix) { public void setSuffix(String suffix) {
@ -888,11 +888,8 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
this.directBuffers = directBuffers; this.directBuffers = directBuffers;
} }
/**
* Access log configuration.
*/
public Accesslog getAccesslog() { public Accesslog getAccesslog() {
return accesslog; return this.accesslog;
} }
/** /**
@ -969,7 +966,6 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
factory.setAccessLogEnabled(this.accesslog.enabled); factory.setAccessLogEnabled(this.accesslog.enabled);
} }
public static class Accesslog { public static class Accesslog {
/** /**
@ -988,7 +984,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
private File dir = new File("logs"); private File dir = new File("logs");
public boolean isEnabled() { public boolean isEnabled() {
return enabled; return this.enabled;
} }
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
@ -996,7 +992,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
} }
public String getPattern() { public String getPattern() {
return pattern; return this.pattern;
} }
public void setPattern(String pattern) { public void setPattern(String pattern) {
@ -1004,7 +1000,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
} }
public File getDir() { public File getDir() {
return dir; return this.dir;
} }
public void setDir(File dir) { public void setDir(File dir) {

@ -88,6 +88,7 @@ public class H2ConsoleAutoConfigurationIntegrationTests {
public void mockConsole() { public void mockConsole() {
} }
} }
} }

@ -109,4 +109,5 @@ public class H2ConsoleAutoConfigurationTests {
assertThat(this.context.getBean(ServletRegistrationBean.class).getUrlMappings(), assertThat(this.context.getBean(ServletRegistrationBean.class).getUrlMappings(),
hasItems("/custom/*")); hasItems("/custom/*"));
} }
} }

@ -89,9 +89,8 @@ public class ColorConverter extends LogEventPatternConverter {
*/ */
public static ColorConverter newInstance(Configuration config, String[] options) { public static ColorConverter newInstance(Configuration config, String[] options) {
if (options.length < 1) { if (options.length < 1) {
LOGGER.error( LOGGER.error("Incorrect number of options on style. "
"Incorrect number of options on style. Expected at least 1, received {}", + "Expected at least 1, received {}", options.length);
options.length);
return null; return null;
} }
if (options[0] == null) { if (options[0] == null) {
@ -100,8 +99,7 @@ public class ColorConverter extends LogEventPatternConverter {
} }
PatternParser parser = PatternLayout.createPatternParser(config); PatternParser parser = PatternLayout.createPatternParser(config);
List<PatternFormatter> formatters = parser.parse(options[0]); List<PatternFormatter> formatters = parser.parse(options[0]);
AnsiElement element = (options.length == 1 ? null : ELEMENTS.get(options[1]));
AnsiElement element = options.length == 1 ? null : ELEMENTS.get(options[1]);
return new ColorConverter(formatters, element); return new ColorConverter(formatters, element);
} }

@ -200,8 +200,8 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
this.loggingSystem.beforeInitialize(); this.loggingSystem.beforeInitialize();
this.logger.info("Hidden"); this.logger.info("Hidden");
this.loggingSystem.initialize(null, null, null); this.loggingSystem.initialize(null, null, null);
this.output this.output.expect(containsString("Wrapped by: "
.expect(containsString("Wrapped by: java.lang.RuntimeException: Expected")); + "java.lang.RuntimeException: Expected"));
this.logger.warn("Expected exception", new RuntimeException("Expected", this.logger.warn("Expected exception", new RuntimeException("Expected",
new RuntimeException("Cause"))); new RuntimeException("Cause")));
} }

@ -252,8 +252,8 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
this.loggingSystem.beforeInitialize(); this.loggingSystem.beforeInitialize();
this.logger.info("Hidden"); this.logger.info("Hidden");
this.loggingSystem.initialize(this.initializationContext, null, null); this.loggingSystem.initialize(this.initializationContext, null, null);
this.output this.output.expect(containsString("Wrapped by: "
.expect(containsString("Wrapped by: java.lang.RuntimeException: Expected")); + "java.lang.RuntimeException: Expected"));
this.logger.warn("Expected exception", new RuntimeException("Expected", this.logger.warn("Expected exception", new RuntimeException("Expected",
new RuntimeException("Cause"))); new RuntimeException("Cause")));
} }

Loading…
Cancel
Save