mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Upgrade to Logback 1.1.7
Closes gh-5568
This commit is contained in:
parent
dad4e84d35
commit
ffe21175ca
@ -20,11 +20,9 @@ import javax.validation.Validation;
|
|||||||
|
|
||||||
import org.apache.catalina.mbeans.MBeanFactory;
|
import org.apache.catalina.mbeans.MBeanFactory;
|
||||||
|
|
||||||
import org.springframework.boot.context.event.ApplicationStartedEvent;
|
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
|
||||||
import org.springframework.boot.logging.LoggingApplicationListener;
|
import org.springframework.boot.logging.LoggingApplicationListener;
|
||||||
import org.springframework.context.ApplicationEvent;
|
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.context.event.ContextRefreshedEvent;
|
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter;
|
import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter;
|
||||||
|
|
||||||
@ -37,21 +35,11 @@ import org.springframework.http.converter.support.AllEncompassingFormHttpMessage
|
|||||||
* @since 1.3.0
|
* @since 1.3.0
|
||||||
*/
|
*/
|
||||||
@Order(LoggingApplicationListener.DEFAULT_ORDER + 1)
|
@Order(LoggingApplicationListener.DEFAULT_ORDER + 1)
|
||||||
public class BackgroundPreinitializer implements ApplicationListener<ApplicationEvent> {
|
public class BackgroundPreinitializer
|
||||||
|
implements ApplicationListener<ApplicationEnvironmentPreparedEvent> {
|
||||||
private volatile Thread initializationThread;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onApplicationEvent(ApplicationEvent event) {
|
public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
|
||||||
if (event instanceof ApplicationStartedEvent) {
|
|
||||||
performInitialization();
|
|
||||||
}
|
|
||||||
else if (event instanceof ContextRefreshedEvent) {
|
|
||||||
awaitInitialization();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void performInitialization() {
|
|
||||||
try {
|
try {
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
|
|
||||||
@ -73,7 +61,6 @@ public class BackgroundPreinitializer implements ApplicationListener<Application
|
|||||||
|
|
||||||
}, "background-preinit");
|
}, "background-preinit");
|
||||||
thread.start();
|
thread.start();
|
||||||
this.initializationThread = thread;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
// This will fail on GAE where creating threads is prohibited. We can safely
|
// This will fail on GAE where creating threads is prohibited. We can safely
|
||||||
@ -82,21 +69,6 @@ public class BackgroundPreinitializer implements ApplicationListener<Application
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void awaitInitialization() {
|
|
||||||
Thread thread = this.initializationThread;
|
|
||||||
if (thread != null) {
|
|
||||||
try {
|
|
||||||
thread.join();
|
|
||||||
}
|
|
||||||
catch (InterruptedException ex) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
this.initializationThread = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Early initializer for Spring MessageConverters.
|
* Early initializer for Spring MessageConverters.
|
||||||
*/
|
*/
|
||||||
@ -132,4 +104,5 @@ public class BackgroundPreinitializer implements ApplicationListener<Application
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@
|
|||||||
<liquibase.version>3.4.2</liquibase.version>
|
<liquibase.version>3.4.2</liquibase.version>
|
||||||
<log4j.version>1.2.17</log4j.version>
|
<log4j.version>1.2.17</log4j.version>
|
||||||
<log4j2.version>2.4.1</log4j2.version>
|
<log4j2.version>2.4.1</log4j2.version>
|
||||||
<logback.version>1.1.6</logback.version>
|
<logback.version>1.1.7</logback.version>
|
||||||
<mariadb.version>1.2.3</mariadb.version>
|
<mariadb.version>1.2.3</mariadb.version>
|
||||||
<mockito.version>1.10.19</mockito.version>
|
<mockito.version>1.10.19</mockito.version>
|
||||||
<mongodb.version>2.13.3</mongodb.version>
|
<mongodb.version>2.13.3</mongodb.version>
|
||||||
|
Loading…
Reference in New Issue
Block a user