@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021-2022 the original author or authors.
|
||||
* Copyright 2021-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,6 @@
|
||||
package org.springframework.shell.boot;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
@@ -29,6 +28,7 @@ import org.springframework.shell.boot.SpringShellProperties.Help;
|
||||
import org.springframework.shell.command.CommandCatalog;
|
||||
import org.springframework.shell.command.CommandCatalogCustomizer;
|
||||
import org.springframework.shell.command.CommandRegistration;
|
||||
import org.springframework.shell.command.CommandRegistration.BuilderSupplier;
|
||||
import org.springframework.shell.command.CommandResolver;
|
||||
|
||||
@AutoConfiguration
|
||||
@@ -76,7 +76,7 @@ public class CommandCatalogAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public Supplier<CommandRegistration.Builder> commandRegistrationBuilderSupplier(
|
||||
public BuilderSupplier commandRegistrationBuilderSupplier(
|
||||
ObjectProvider<CommandRegistrationCustomizer> customizerProvider) {
|
||||
return () -> {
|
||||
CommandRegistration.Builder builder = CommandRegistration.builder();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2022 the original author or authors.
|
||||
* Copyright 2017-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.shell.boot;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -55,7 +53,7 @@ public class StandardAPIAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public MethodTargetRegistrar standardMethodTargetResolver(ApplicationContext applicationContext,
|
||||
Supplier<CommandRegistration.Builder> builder) {
|
||||
CommandRegistration.BuilderSupplier builder) {
|
||||
return new StandardMethodTargetRegistrar(applicationContext, builder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -137,6 +137,14 @@ public interface CommandRegistration {
|
||||
return new DefaultBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface used to supply instance of a {@link Builder}. Meant to be a single
|
||||
* point access to centrally configured builder in an application context.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface BuilderSupplier extends Supplier<Builder> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Spec defining an option.
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@ include::{snippets}/CommandRegistrationBeanSnippets.java[tag=plain]
|
||||
====
|
||||
|
||||
If all your commands have something in common, an instance of
|
||||
a _Supplier<CommandRegistration.Builder>_ is created which can
|
||||
a _CommandRegistration.BuilderSupplier_ is created which can
|
||||
be autowired. Default implementation of this supplier returns
|
||||
a new builder so you don't need to worry about its internal state.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.shell.docs;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.shell.boot.CommandRegistrationCustomizer;
|
||||
import org.springframework.shell.command.CommandRegistration;
|
||||
@@ -37,7 +35,7 @@ public class CommandRegistrationBeanSnippets {
|
||||
class Dump2 {
|
||||
// tag::fromsupplier[]
|
||||
@Bean
|
||||
CommandRegistration commandRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
CommandRegistration commandRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command("mycommand")
|
||||
.build();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.shell.samples.e2e;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.shell.command.CommandRegistration;
|
||||
import org.springframework.shell.command.CommandRegistration.OptionArity;
|
||||
@@ -40,7 +38,7 @@ public class ArityCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration testBooleanArity1DefaultTrueRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration testBooleanArity1DefaultTrueRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "boolean-arity1-default-true")
|
||||
.group(GROUP)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.shell.samples.e2e;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.shell.command.CommandRegistration;
|
||||
import org.springframework.shell.standard.ShellComponent;
|
||||
@@ -39,7 +37,7 @@ public class DefaultValueCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration testDefaultValueRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration testDefaultValueRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "default-value")
|
||||
.group(GROUP)
|
||||
@@ -64,7 +62,7 @@ public class DefaultValueCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration testDefaultValueBoolean1Registration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration testDefaultValueBoolean1Registration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "default-value-boolean1")
|
||||
.group(GROUP)
|
||||
@@ -90,7 +88,7 @@ public class DefaultValueCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration testDefaultValueBoolean2Registration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration testDefaultValueBoolean2Registration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "default-value-boolean2")
|
||||
.group(GROUP)
|
||||
@@ -116,7 +114,7 @@ public class DefaultValueCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration testDefaultValueBoolean3Registration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration testDefaultValueBoolean3Registration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "default-value-boolean3")
|
||||
.group(GROUP)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@ package org.springframework.shell.samples.e2e;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.jline.terminal.Terminal;
|
||||
|
||||
@@ -87,7 +86,7 @@ public class ErrorHandlingCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
CommandRegistration testErrorHandlingRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
CommandRegistration testErrorHandlingRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "error-handling")
|
||||
.group(GROUP)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.shell.samples.e2e;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.shell.command.CommandRegistration;
|
||||
import org.springframework.shell.standard.ShellComponent;
|
||||
@@ -30,7 +28,7 @@ import org.springframework.shell.standard.ShellComponent;
|
||||
public class ExitCodeCommands extends BaseE2ECommands {
|
||||
|
||||
@Bean
|
||||
public CommandRegistration testExitCodeRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration testExitCodeRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "exit-code")
|
||||
.group(GROUP)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.shell.samples.e2e;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.shell.command.CommandRegistration;
|
||||
@@ -28,7 +26,7 @@ import org.springframework.shell.standard.ShellOption;
|
||||
public class HelpOptionCommands extends BaseE2ECommands {
|
||||
|
||||
@Autowired
|
||||
Supplier<CommandRegistration.Builder> builder;
|
||||
CommandRegistration.BuilderSupplier builder;
|
||||
|
||||
@ShellMethod(key = LEGACY_ANNO + "help-option-default", group = GROUP)
|
||||
public String testHelpOptionDefault(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.shell.samples.e2e;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.shell.command.CommandRegistration;
|
||||
import org.springframework.shell.standard.ShellComponent;
|
||||
@@ -25,7 +23,7 @@ import org.springframework.shell.standard.ShellComponent;
|
||||
public class HiddenCommands extends BaseE2ECommands {
|
||||
|
||||
@Bean
|
||||
public CommandRegistration testHidden1Registration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration testHidden1Registration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "hidden-1")
|
||||
.group(GROUP)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@ package org.springframework.shell.samples.e2e;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -41,7 +40,7 @@ public class InteractiveCompletionCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
CommandRegistration testInteractiveCompletion1Registration(Supplier<CommandRegistration.Builder> builder) {
|
||||
CommandRegistration testInteractiveCompletion1Registration(CommandRegistration.BuilderSupplier builder) {
|
||||
Test1ValuesProvider test1ValuesProvider = new Test1ValuesProvider();
|
||||
Test2ValuesProvider test2ValuesProvider = new Test2ValuesProvider();
|
||||
return builder.get()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,6 @@
|
||||
package org.springframework.shell.samples.e2e;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.shell.command.CommandRegistration;
|
||||
@@ -33,7 +32,7 @@ import org.springframework.shell.standard.ShellOption;
|
||||
public class OptionTypeCommands extends BaseE2ECommands {
|
||||
|
||||
@Bean
|
||||
public CommandRegistration testOptionTypeRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration testOptionTypeRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "option-type")
|
||||
.group(GROUP)
|
||||
@@ -77,7 +76,7 @@ public class OptionTypeCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration optionTypeStringRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration optionTypeStringRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "option-type-string")
|
||||
.group(GROUP)
|
||||
@@ -113,7 +112,7 @@ public class OptionTypeCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration optionTypeBooleanRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration optionTypeBooleanRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "option-type-boolean")
|
||||
.group(GROUP)
|
||||
@@ -173,7 +172,7 @@ public class OptionTypeCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration optionTypeIntegerRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration optionTypeIntegerRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "option-type-integer")
|
||||
.group(GROUP)
|
||||
@@ -213,7 +212,7 @@ public class OptionTypeCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration optionTypeEnumRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration optionTypeEnumRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "option-type-enum")
|
||||
.group(GROUP)
|
||||
@@ -236,7 +235,7 @@ public class OptionTypeCommands extends BaseE2ECommands {
|
||||
//
|
||||
|
||||
@Bean
|
||||
public CommandRegistration optionTypeVoidRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration optionTypeVoidRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "option-type-void")
|
||||
.group(GROUP)
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.shell.samples.e2e;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.shell.command.CommandRegistration;
|
||||
import org.springframework.shell.standard.ShellComponent;
|
||||
@@ -39,7 +37,7 @@ public class OptionalValueCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration testOptionalValueRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration testOptionalValueRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "optional-value")
|
||||
.group(GROUP)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.shell.samples.e2e;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.shell.command.CommandRegistration;
|
||||
import org.springframework.shell.standard.ShellComponent;
|
||||
@@ -39,7 +37,7 @@ public class RequiredValueCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration testRequiredValueRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration testRequiredValueRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "required-value")
|
||||
.group(GROUP)
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.shell.samples.e2e;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.shell.command.CommandRegistration;
|
||||
import org.springframework.shell.standard.ShellComponent;
|
||||
@@ -33,7 +31,7 @@ public class UnrecognisedOptionCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration testUnrecognisedOptionNoOtherRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration testUnrecognisedOptionNoOtherRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "unrecognised-option-noother")
|
||||
.group(GROUP)
|
||||
@@ -53,7 +51,7 @@ public class UnrecognisedOptionCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration testUnrecognisedOptionWithRequiredRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration testUnrecognisedOptionWithRequiredRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "unrecognised-option-withrequired")
|
||||
.group(GROUP)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.shell.samples.e2e;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -42,7 +40,7 @@ public class ValidatedValueCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration testValidatedValueRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration testValidatedValueRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "validated-value")
|
||||
.group(GROUP)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.shell.samples.e2e;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.jline.terminal.Terminal;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -32,7 +30,7 @@ public class WriteCommands extends BaseE2ECommands {
|
||||
Terminal terminal;
|
||||
|
||||
@Bean
|
||||
public CommandRegistration writeTerminalWriterRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration writeTerminalWriterRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "write-terminalwriter")
|
||||
.group(GROUP)
|
||||
@@ -52,7 +50,7 @@ public class WriteCommands extends BaseE2ECommands {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandRegistration writeSystemOutRegistration(Supplier<CommandRegistration.Builder> builder) {
|
||||
public CommandRegistration writeSystemOutRegistration(CommandRegistration.BuilderSupplier builder) {
|
||||
return builder.get()
|
||||
.command(REG, "write-terminalwriter")
|
||||
.group(GROUP)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2022 the original author or authors.
|
||||
* Copyright 2015-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -68,10 +68,10 @@ public class StandardMethodTargetRegistrar implements MethodTargetRegistrar {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(StandardMethodTargetRegistrar.class);
|
||||
private ApplicationContext applicationContext;
|
||||
private Supplier<CommandRegistration.Builder> commandRegistrationBuilderSupplier;
|
||||
private CommandRegistration.BuilderSupplier commandRegistrationBuilderSupplier;
|
||||
|
||||
public StandardMethodTargetRegistrar(ApplicationContext applicationContext,
|
||||
Supplier<CommandRegistration.Builder> commandRegistrationBuilderSupplier) {
|
||||
CommandRegistration.BuilderSupplier commandRegistrationBuilderSupplier) {
|
||||
this.applicationContext = applicationContext;
|
||||
this.commandRegistrationBuilderSupplier = commandRegistrationBuilderSupplier;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2022 the original author or authors.
|
||||
* Copyright 2017-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.shell.standard;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -47,7 +46,7 @@ public class StandardMethodTargetRegistrarTests {
|
||||
private AnnotationConfigApplicationContext applicationContext;
|
||||
private CommandCatalog catalog;
|
||||
private DefaultShellContext shellContext;
|
||||
private Supplier<CommandRegistration.Builder> builder = () -> CommandRegistration.builder();
|
||||
private CommandRegistration.BuilderSupplier builder = () -> CommandRegistration.builder();
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
|
||||
Reference in New Issue
Block a user