@@ -691,6 +691,8 @@ public EnvDep(final Predicate<String> predicate, final Consumer<Config> callback
691691
692692 private List <Consumer <Binder >> executors = new ArrayList <>();
693693
694+ private boolean defaultExecSet ;
695+
694696 /**
695697 * Creates a new {@link Jooby} application.
696698 */
@@ -2306,6 +2308,7 @@ public Jooby executor(final ExecutorService executor) {
23062308 * @return This jooby instance.
23072309 */
23082310 public Jooby executor (final Executor executor ) {
2311+ this .defaultExecSet = true ;
23092312 this .executors .add (binder -> {
23102313 binder .bind (Key .get (String .class , Names .named ("deferred" ))).toInstance ("deferred" );
23112314 binder .bind (Key .get (Executor .class , Names .named ("deferred" ))).toInstance (executor );
@@ -2363,6 +2366,7 @@ public Jooby executor(final String name, final Executor executor) {
23632366 * @return This jooby instance.
23642367 */
23652368 public Jooby executor (final String name ) {
2369+ defaultExecSet = true ;
23662370 this .executors .add (binder -> {
23672371 binder .bind (Key .get (String .class , Names .named ("deferred" ))).toInstance (name );
23682372 });
@@ -2483,8 +2487,8 @@ private Injector bootstrap(final Config args,
24832487 throw new IllegalStateException ("Required property 'application.secret' is missing" );
24842488 }
24852489
2486- /** executors . */
2487- if (executors . isEmpty () ) {
2490+ /** executors: */
2491+ if (! defaultExecSet ) {
24882492 // default executor
24892493 executor (MoreExecutors .directExecutor ());
24902494 }
0 commit comments