@@ -44,7 +44,7 @@ import javax.validation.Validator;
|
||||
public class SpringShellAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(ConversionService.class)
|
||||
@Qualifier("spring-shell")
|
||||
public ConversionService conversionService(ApplicationContext applicationContext) {
|
||||
Collection<Converter> converters = applicationContext.getBeansOfType(Converter.class).values();
|
||||
Collection<GenericConverter> genericConverters = applicationContext.getBeansOfType(GenericConverter.class).values();
|
||||
@@ -63,6 +63,11 @@ public class SpringShellAutoConfiguration {
|
||||
return defaultConversionService;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConversionService other() {
|
||||
return new DefaultConversionService();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(Validator.class)
|
||||
public Validator validator() {
|
||||
|
||||
@@ -929,7 +929,8 @@ See xref:validating-command-arguments[] for more information.
|
||||
If you want to customize the `ConversionService` further, you can either
|
||||
|
||||
* Have the default one injected in your code and act upon it in some way
|
||||
* Override it altogether with your own (custom converters will need to be registered by hand)
|
||||
* Override it altogether with your own (custom converters will need to be registered by hand).
|
||||
The ConversionService used by Spring Shell needs to be https://docs.spring.io/spring/docs/4.3.12.RELEASE/spring-framework-reference/htmlsingle/#beans-autowired-annotation-qualifiers[qualified] as `"spring-shell"`.
|
||||
====
|
||||
|
||||
//==== Overriding the JLine Parser
|
||||
|
||||
@@ -16,6 +16,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.core.convert.ConversionService;
|
||||
@@ -52,7 +53,7 @@ public class StandardAPIAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ParameterResolver standardParameterResolver(ConversionService conversionService) {
|
||||
public ParameterResolver standardParameterResolver(@Qualifier("spring-shell") ConversionService conversionService) {
|
||||
return new StandardParameterResolver(conversionService);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user