Make ResultHandlers configuration more explicit

Handle exit as a dedicated case (prevents eg 'exit' commands in scripts to make script quit)
Add an example of custom ApplicationRunner

Fixes #187
Fixes #183

Decouple ApplicationRunners

Make ThrowableResultHandler behave differently in non-interactive mode
This commit is contained in:
Eric Bottard
2017-12-24 16:49:44 +01:00
parent 6e6154a80a
commit f90edd42c4
16 changed files with 324 additions and 128 deletions

View File

@@ -36,8 +36,6 @@ public class CommandValueProvider extends ValueProviderSupport {
private final CommandRegistry commandRegistry;
@Lazy
@Autowired
public CommandValueProvider(CommandRegistry commandRegistry) {
this.commandRegistry = commandRegistry;
}

View File

@@ -19,6 +19,7 @@ package org.springframework.shell.standard;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.convert.ConversionService;
import org.springframework.shell.CommandRegistry;
import org.springframework.shell.MethodTargetRegistrar;
@@ -33,7 +34,7 @@ import org.springframework.shell.ParameterResolver;
public class StandardAPIAutoConfiguration {
@Bean
public ValueProvider commandValueProvider(CommandRegistry commandRegistry) {
public ValueProvider commandValueProvider(@Lazy CommandRegistry commandRegistry) {
return new CommandValueProvider(commandRegistry);
}