@ -22,17 +22,18 @@ import java.util.Arrays;
import org.apache.commons.logging.Log ;
import org.apache.commons.logging.Log ;
import org.apache.commons.logging.LogFactory ;
import org.apache.commons.logging.LogFactory ;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent ;
import org.springframework.boot.context.event.ApplicationFailedEvent ;
import org.springframework.boot.context.event.ApplicationFailedEvent ;
import org.springframework.boot.context.event.ApplicationStartedEvent ;
import org.springframework.context.ApplicationEvent ;
import org.springframework.context.ApplicationEvent ;
import org.springframework.context.event.GenericApplicationListener ;
import org.springframework.context.event.GenericApplicationListener ;
import org.springframework.context.event.SmartApplicationListener ;
import org.springframework.context.event.SmartApplicationListener ;
import org.springframework.core.ResolvableType ;
import org.springframework.core.ResolvableType ;
/ * *
/ * *
* A { @link SmartApplicationListener } that reacts to { @link ApplicationStartedEvent start
* A { @link SmartApplicationListener } that reacts to
* events } and to { @link ApplicationFailedEvent failed events } by logging the classpath of
* { @link ApplicationEnvironmentPreparedEvent environment prepared events } and to
* the thread context class loader ( TCCL ) at { @code DEBUG } level .
* { @link ApplicationFailedEvent failed events } by logging the classpath of the thread
* context class loader ( TCCL ) at { @code DEBUG } level .
*
*
* @author Andy Wilkinson
* @author Andy Wilkinson
* /
* /
@ -46,7 +47,7 @@ public final class ClasspathLoggingApplicationListener
@Override
@Override
public void onApplicationEvent ( ApplicationEvent event ) {
public void onApplicationEvent ( ApplicationEvent event ) {
if ( this . logger . isDebugEnabled ( ) ) {
if ( this . logger . isDebugEnabled ( ) ) {
if ( event instanceof ApplicationStart edEvent ) {
if ( event instanceof ApplicationEnvironmentPrepar edEvent ) {
this . logger
this . logger
. debug ( "Application started with classpath: " + getClasspath ( ) ) ;
. debug ( "Application started with classpath: " + getClasspath ( ) ) ;
}
}
@ -68,7 +69,7 @@ public final class ClasspathLoggingApplicationListener
if ( type = = null ) {
if ( type = = null ) {
return false ;
return false ;
}
}
return ApplicationStart edEvent . class . isAssignableFrom ( type )
return ApplicationEnvironmentPrepar edEvent . class . isAssignableFrom ( type )
| | ApplicationFailedEvent . class . isAssignableFrom ( type ) ;
| | ApplicationFailedEvent . class . isAssignableFrom ( type ) ;
}
}