Override yml configuration in spring-boot with command line arguments not work
问题 I have a spring-boot application. I want to override some properties which was configuration in application.yml when executing the jar. My code like this: @Service public class CommandService { @Value("${name:defaultName}") private String name; public void print() { System.out.println(name); } } And the Application.java is @SpringBootApplication public class Application implements CommandLineRunner { @Autowired private CommandService commandService; public static void main(String[] args) {