package com.munjaon.client.config; import com.munjaon.client.server.service.PropertyLoader; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.configuration2.ex.ConfigurationException; import org.springframework.boot.CommandLineRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; @Slf4j @Configuration @RequiredArgsConstructor public class RunnerConfiguration { private final ServerConfig serverConfig; @Bean @Order(1) public CommandLineRunner getRunnerBeanForProperty() { System.setProperty("PROPS", serverConfig.getServerProperyFile()); System.setProperty("ROOTPATH", serverConfig.getServerRootPath()); PropertyLoader.load(); try { String[] array = serverConfig.getStringArray("test.list"); if (array != null && array.length > 0) { for (String s : array) { System.out.println("List : " + s); } } } catch (ConfigurationException e) { throw new RuntimeException(e); } return args -> System.out.println("Runner Bean #1 : " + serverConfig.getServerProperyFile()); } @Bean @Order(2) public CommandLineRunner getRunnerBeanForSmsQueue() { return args -> System.out.println("Runner Bean #2"); } }