定义Command接口 public interface Command { void execute(); } 定义Receiver @Component public class Light { public void turnOn() { System.out.println("The light is on"); } public void turnOff() { System.out.println("The light is off"); } } <