Merge branch '1.1.x'
Conflicts: spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java
This commit is contained in:
commit
3328c1369f
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 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.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 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.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 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.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2015 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.
|
||||
|
|
|
|||
|
|
@ -142,9 +142,9 @@ Their purpose is to load resources (`.class` files etc.) from nested jar files o
|
|||
files in directories (as opposed to explicitly on the classpath). In the case of the
|
||||
`[Jar|War]Launcher` the nested paths are fixed (`+lib/*.jar+` and `+lib-provided/*.jar+` for
|
||||
the war case) so you just add extra jars in those locations if you want more. The
|
||||
`PropertiesLauncher` looks in `lib/` in your application archive by default, but you can add additional locations by
|
||||
setting an environment variable `LOADER_PATH` or `loader.path` in `application.properties`
|
||||
(comma-separated list of directories or archives).
|
||||
`PropertiesLauncher` looks in `lib/` in your application archive by default, but you can
|
||||
add additional locations by setting an environment variable `LOADER_PATH` or `loader.path`
|
||||
in `application.properties` (comma-separated list of directories or archives).
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 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.
|
||||
|
|
@ -76,4 +76,5 @@ public class MultiProjectRepackagingTests {
|
|||
assertThat(jarFile.getEntry("lib/projectB.jar"), notNullValue());
|
||||
jarFile.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
* Copyright 2012-2015 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.
|
||||
|
|
@ -21,7 +21,7 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
|||
/**
|
||||
* Main class to start the embedded server.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public final class EmbeddedJarStarter {
|
||||
|
||||
|
|
@ -30,4 +30,5 @@ public final class EmbeddedJarStarter {
|
|||
context.getBean(SpringConfiguration.class).run(args);
|
||||
context.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
* Copyright 2012-2015 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.
|
||||
|
|
@ -27,19 +27,19 @@ import org.springframework.core.io.support.PropertiesLoaderUtils;
|
|||
/**
|
||||
* Spring configuration.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
public class SpringConfiguration {
|
||||
|
||||
|
||||
private String message = "Jar";
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void init() throws IOException {
|
||||
String value = PropertiesLoaderUtils.loadAllProperties("application.properties").getProperty("message");
|
||||
if (value!=null) {
|
||||
this.message = value;
|
||||
this.message = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -48,6 +48,4 @@ public class SpringConfiguration {
|
|||
System.err.println("Hello Embedded " + this.message + "!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 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.
|
||||
|
|
@ -553,7 +553,7 @@ public class PropertiesLauncher extends Launcher {
|
|||
urls.addAll(index + 1, extra);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
catch (Exception ex) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 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.
|
||||
|
|
@ -266,7 +266,7 @@ public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContaine
|
|||
|
||||
private String message;
|
||||
|
||||
private boolean errorToSend = false;
|
||||
private boolean hasErrorToSend = false;
|
||||
|
||||
public ErrorWrapperResponse(HttpServletResponse response) {
|
||||
super(response);
|
||||
|
|
@ -281,25 +281,23 @@ public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContaine
|
|||
public void sendError(int status, String message) throws IOException {
|
||||
this.status = status;
|
||||
this.message = message;
|
||||
this.errorToSend = true;
|
||||
this.hasErrorToSend = true;
|
||||
// Do not call super because the container may prevent us from handling the
|
||||
// error ourselves
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus() {
|
||||
if (this.errorToSend) {
|
||||
if (this.hasErrorToSend) {
|
||||
return this.status;
|
||||
}
|
||||
else {
|
||||
// If there was no error we need to trust the wrapped response
|
||||
return super.getStatus();
|
||||
}
|
||||
// If there was no error we need to trust the wrapped response
|
||||
return super.getStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushBuffer() throws IOException {
|
||||
if (this.errorToSend && !isCommitted()) {
|
||||
if (this.hasErrorToSend && !isCommitted()) {
|
||||
((HttpServletResponse) getResponse())
|
||||
.sendError(this.status, this.message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ public class LoggingApplicationListener implements SmartApplicationListener {
|
|||
return isAssignableFrom(sourceType, SOURCE_TYPES);
|
||||
}
|
||||
|
||||
private boolean isAssignableFrom(Class<?> type, Class<?>[] supportedTypes) {
|
||||
private boolean isAssignableFrom(Class<?> type, Class<?>... supportedTypes) {
|
||||
for (Class<?> supportedType : supportedTypes) {
|
||||
if (supportedType.isAssignableFrom(type)) {
|
||||
return true;
|
||||
|
|
@ -139,7 +139,7 @@ public class LoggingApplicationListener implements SmartApplicationListener {
|
|||
onApplicationStartedEvent((ApplicationStartedEvent) event);
|
||||
}
|
||||
else if (event instanceof ApplicationEnvironmentPreparedEvent) {
|
||||
onApplicationPreparedEvent((ApplicationEnvironmentPreparedEvent) event);
|
||||
onApplicationEnvironmentPreparedEvent((ApplicationEnvironmentPreparedEvent) event);
|
||||
}
|
||||
else if (event instanceof ContextClosedEvent) {
|
||||
onContextClosedEvent();
|
||||
|
|
@ -152,7 +152,8 @@ public class LoggingApplicationListener implements SmartApplicationListener {
|
|||
this.loggingSystem.beforeInitialize();
|
||||
}
|
||||
|
||||
private void onApplicationPreparedEvent(ApplicationEnvironmentPreparedEvent event) {
|
||||
private void onApplicationEnvironmentPreparedEvent(
|
||||
ApplicationEnvironmentPreparedEvent event) {
|
||||
if (this.loggingSystem == null) {
|
||||
this.loggingSystem = LoggingSystem.get(event.getSpringApplication()
|
||||
.getClassLoader());
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ public abstract class LoggingSystem {
|
|||
* should override this method to perform any logging system-specific cleanup.
|
||||
*/
|
||||
public void cleanUp() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
* Copyright 2012-2015 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.
|
||||
|
|
@ -55,6 +55,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link ErrorPageFilter}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
|
|
@ -120,6 +121,7 @@ public class ErrorPageFilterIntegrationTests {
|
|||
public HelloWorldController helloWorldController() {
|
||||
return new HelloWorldController();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Controller
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue