Remove bean cycles
- Shuffle things around into different auto-config and configuration classes and use other tricks like ObjectProvider to work around boot 2.6.x imposing bean cycle checks. - This is first set of changes to work around this issue, not to make things perfect. Further refactoring work is needed making code base more boot 2.x friendly as things are based on boot 1.5.x times. - Fixes #324
This commit is contained in:
@@ -8,6 +8,7 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.shell.CommandRegistry;
|
||||
import org.springframework.shell.MethodTarget;
|
||||
import org.springframework.shell.Shell;
|
||||
import org.springframework.shell.jline.InteractiveShellApplicationRunner;
|
||||
@@ -23,8 +24,7 @@ import static org.springframework.util.ReflectionUtils.findMethod;
|
||||
*
|
||||
* @author Sualeh Fatehi
|
||||
*/
|
||||
@SpringBootTest(properties = { InteractiveShellApplicationRunner.SPRING_SHELL_INTERACTIVE_ENABLED + "=" + false,
|
||||
"spring.main.allow-circular-references=true" })
|
||||
@SpringBootTest(properties = { InteractiveShellApplicationRunner.SPRING_SHELL_INTERACTIVE_ENABLED + "=" + false })
|
||||
@ContextConfiguration(classes = TestCalculatorStateConfig.class)
|
||||
public class CalculatorCommandsIntegrationTest extends BaseCalculatorTest {
|
||||
|
||||
@@ -33,6 +33,9 @@ public class CalculatorCommandsIntegrationTest extends BaseCalculatorTest {
|
||||
@Autowired
|
||||
private Shell shell;
|
||||
|
||||
@Autowired
|
||||
private CommandRegistry commandRegistry;
|
||||
|
||||
@Autowired
|
||||
private CalculatorState state;
|
||||
|
||||
@@ -45,7 +48,7 @@ public class CalculatorCommandsIntegrationTest extends BaseCalculatorTest {
|
||||
final String command = "add";
|
||||
final String commandMethod = "add";
|
||||
|
||||
final MethodTarget commandTarget = lookupCommand(shell, command);
|
||||
final MethodTarget commandTarget = lookupCommand(commandRegistry, command);
|
||||
assertThat(commandTarget).isNotNull();
|
||||
assertThat(commandTarget.getGroup()).isEqualTo("Calculator Commands");
|
||||
assertThat(commandTarget.getHelp()).isEqualTo("Add two integers");
|
||||
@@ -67,7 +70,7 @@ public class CalculatorCommandsIntegrationTest extends BaseCalculatorTest {
|
||||
final String command = "add-to-memory";
|
||||
final String commandMethod = "addToMemory";
|
||||
|
||||
final MethodTarget commandTarget = lookupCommand(shell, command);
|
||||
final MethodTarget commandTarget = lookupCommand(commandRegistry, command);
|
||||
assertThat(commandTarget).isNotNull();
|
||||
assertThat(commandTarget.getGroup()).isEqualTo("Calculator Commands");
|
||||
assertThat(commandTarget.getHelp()).isEqualTo("Add an integer to the value in memory");
|
||||
|
||||
Reference in New Issue
Block a user