Polish
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017 the original author or authors.
|
||||
* Copyright 2017-2021 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.
|
||||
@@ -21,7 +21,6 @@ import org.jline.utils.AttributedStyle;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.shell.jline.PromptProvider;
|
||||
|
||||
@@ -36,7 +35,7 @@ import org.springframework.shell.jline.PromptProvider;
|
||||
public class SpringShellSample {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
ConfigurableApplicationContext context = SpringApplication.run(SpringShellSample.class, args);
|
||||
SpringApplication.run(SpringShellSample.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017 the original author or authors.
|
||||
* Copyright 2017-2021 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.noautoconf;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.shell.SpringShellAutoConfiguration;
|
||||
@@ -58,7 +57,7 @@ import org.springframework.shell.standard.commands.StandardCommandsAutoConfigura
|
||||
public class NoAutoConf {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ConfigurableApplicationContext context = SpringApplication.run(NoAutoConf.class, args);
|
||||
SpringApplication.run(NoAutoConf.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017 the original author or authors.
|
||||
* Copyright 2017-2021 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.
|
||||
@@ -37,6 +37,10 @@ class DomainObject {
|
||||
DomainObject(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017 the original author or authors.
|
||||
* Copyright 2017-2021 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.
|
||||
@@ -31,15 +31,12 @@ public class DynamicCommands {
|
||||
|
||||
private boolean connected;
|
||||
|
||||
private boolean authenticated;
|
||||
|
||||
public Availability authenticateAvailability() {
|
||||
return connected ? Availability.available() : Availability.unavailable("you are not connected");
|
||||
}
|
||||
|
||||
@ShellMethod(value = "Authenticate with the system", group = "Dynamic Commands")
|
||||
public void authenticate(String credentials) {
|
||||
authenticated = "sesame".equals(credentials);
|
||||
}
|
||||
|
||||
@ShellMethod(value = "Connect to the system", group = "Dynamic Commands")
|
||||
@@ -57,8 +54,4 @@ public class DynamicCommands {
|
||||
public String blowUp() {
|
||||
return "Boom!";
|
||||
}
|
||||
|
||||
private Availability dangerousAvailability() {
|
||||
return connected && authenticated ? Availability.available() : Availability.unavailable("you failed to authenticate. Try 'sesame'.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user