Create BuilderSupplier interface

- Fixes #607
This commit is contained in:
Janne Valkealahti
2023-01-08 13:38:33 +00:00
parent 9b4e347633
commit f91b255bda
20 changed files with 56 additions and 76 deletions

View File

@@ -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.

View File

@@ -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();