스프링 부트 애플리케이션 실행할 때 코드를 실행하는 방법
@Bean
public CommandLineRunner run(VoucherEnrollSystem voucherEnrollSystem) {
return args -> voucherEnrollSystem.run();
}
이 외에도 ApplicationReadyEvent 도 있음.
https://madplay.github.io/post/run-code-on-application-startup-in-springboot
public enum VoucherType {
FIXED(1), PERCENT(2);
private final int number;
VoucherType(int number) {
this.number = number;
}
public int getNumber() {
return number;
}
}
getNumber메서드를 통해 number값도 얻을 수 있다.
boolean validateInputString = Arrays.stream(InputCommend.values()).map(String::valueOf).anyMatch(v -> v.equals(inputString.toUpperCase()));
stream으로 꺼낸 값들의 type은 InputCommend라서 형변환이 필요했다.
anyMatch로 판별할 수 있었다.
file:
name: logs
max-history: 7
max-size: 5KB
total-size-cap: 1MB
level:
org.voucherProject.voucherProject: warn