5757
5858import java .io .File ;
5959import java .lang .reflect .Type ;
60- import java .net .URL ;
6160import java .nio .charset .Charset ;
6261import java .nio .file .Path ;
6362import java .nio .file .Paths ;
7675import java .util .Locale ;
7776import java .util .Map ;
7877import java .util .Map .Entry ;
78+ import java .util .Objects ;
7979import java .util .Optional ;
8080import java .util .Set ;
8181import java .util .TimeZone ;
@@ -2430,7 +2430,8 @@ public Jooby executor(final String name) {
24302430 */
24312431 private Jooby executor (final String name , final Class <? extends Provider <Executor >> provider ) {
24322432 this .executors .add (binder -> {
2433- binder .bind (Key .get (Executor .class , Names .named (name ))).toProvider (provider ).in (Singleton .class );
2433+ binder .bind (Key .get (Executor .class , Names .named (name ))).toProvider (provider )
2434+ .in (Singleton .class );
24342435 });
24352436 return this ;
24362437 }
@@ -3198,7 +3199,6 @@ static String logback(final Config conf) {
31983199 logback = conf .getString ("logback.configurationFile" );
31993200 } else {
32003201 String env = conf .hasPath ("application.env" ) ? conf .getString ("application.env" ) : null ;
3201- URL cpconf = Jooby .class .getResource ("/logback." + env + ".xml" );
32023202 ImmutableList .Builder <File > files = ImmutableList .builder ();
32033203 File userdir = new File (System .getProperty ("user.dir" ));
32043204 File confdir = new File (userdir , "conf" );
@@ -3213,7 +3213,11 @@ static String logback(final Config conf) {
32133213 .filter (f -> f .exists ())
32143214 .map (f -> f .getAbsolutePath ())
32153215 .findFirst ()
3216- .orElse ((cpconf != null ) ? cpconf .toString () : "logback.xml" );
3216+ .orElseGet (() -> {
3217+ return Optional .ofNullable (Jooby .class .getResource ("/logback." + env + ".xml" ))
3218+ .map (Objects ::toString )
3219+ .orElse ("logback.xml" );
3220+ });
32173221 }
32183222 return logback ;
32193223 }
0 commit comments