dmadunic / clidemo

Sample SpringShell CLI demo
GNU General Public License v3.0
44 stars 18 forks source link

The dependencies of some of the beans in the application context form a cycle: #5

Open zacksleo opened 4 years ago

zacksleo commented 4 years ago

Hi dmadunic, thanks for you project share. I have a problem if you can help. If I create a new Command that autowired InputReader, I got this error below:

The dependencies of some of the beans in the application context form a cycle:

   testCommand (field com.yiwu.command.shell.InputReader com.yiwu.command.commands.TestCommand.inputReader)
┌─────┐
|  inputReader defined in class path resource [com/yiwu/command/config/SpringShellConfig.class]
↑     ↓
|  org.springframework.shell.jline.JLineShellAutoConfiguration (field private org.springframework.shell.Shell org.springframework.shell.jline.JLineShellAutoConfiguration.shell)
↑     ↓
|  shell
↑     ↓
|  userCommand (field com.yiwu.command.shell.InputReader com.yiwu.command.commands.UserCommand.inputReader)
``

cat TestCommand

@ShellComponent public class TestCommand {

@Autowired
ShellHelper shellHelper;

@Autowired
InputReader inputReader;

@Autowired
ProgressBar progressBar;

@Autowired
ProgressCounter progressCounter;

}

dmadunic commented 4 years ago

Hi zacks i would gladly help. Do you maybe have a git repository I can take look at? I would like to clone it and check it out.