Allow usage without Spring Boot AutoConfiguration

Fixes #166
This commit is contained in:
Eric Bottard
2017-10-04 11:15:01 +02:00
parent f0e5c45ee9
commit 32c65f2da7
3 changed files with 71 additions and 3 deletions

View File

@@ -61,12 +61,12 @@ import org.springframework.shell.Shell;
* @author Florent Biville
*/
@Configuration
class JLineShellAutoConfiguration {
public class JLineShellAutoConfiguration {
@Autowired
private PromptProvider promptProvider;
@Autowired
@Autowired @Lazy
private History history;
@Autowired

View File

@@ -0,0 +1,69 @@
/*
* Copyright 2017 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.shell.samples.noautoconf;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.shell.SpringShellAutoConfiguration;
import org.springframework.shell.jcommander.JCommanderParameterResolverAutoConfiguration;
import org.springframework.shell.jline.JLineShellAutoConfiguration;
import org.springframework.shell.legacy.LegacyAdapterAutoConfiguration;
import org.springframework.shell.samples.jcommander.JCommanderCommands;
import org.springframework.shell.samples.legacy.LegacyCommands;
import org.springframework.shell.samples.standard.Commands;
import org.springframework.shell.samples.standard.DynamicCommands;
import org.springframework.shell.samples.standard.TableCommands;
import org.springframework.shell.standard.FileValueProvider;
import org.springframework.shell.standard.StandardAPIAutoConfiguration;
import org.springframework.shell.standard.commands.StandardCommandsAutoConfiguration;
/**
* This class shows how to use the full extent of Spring Shell without relying on Boot auto configuration.
*
* @author Eric Bottard
*/
@Configuration
@Import({
// Core runtime
SpringShellAutoConfiguration.class,
JLineShellAutoConfiguration.class,
// Various Resolvers
JCommanderParameterResolverAutoConfiguration.class,
LegacyAdapterAutoConfiguration.class,
StandardAPIAutoConfiguration.class,
// Built-In Commands
StandardCommandsAutoConfiguration.class,
// Allows ${} supports
PropertyPlaceholderAutoConfiguration.class,
// Sample Commands
JCommanderCommands.class,
LegacyCommands.class,
Commands.class,
FileValueProvider.class,
DynamicCommands.class,
TableCommands.class,
})
public class NoAutoConf {
public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(NoAutoConf.class, args);
}
}

View File

@@ -26,7 +26,6 @@
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-standard-commands</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.shell</groupId>