springboot 비 웹 프로젝트

사용 CommandRunner

@SpringBootApplication
public class NotwebApplication implements CommandLineRunner {

    @Autowired
    private HelloService helloService;

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(NotwebApplication.class);
        app.setBannerMode(Banner.Mode.OFF);
        app.run();
    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println(helloService.getName());
        System.exit(0);
    }
}
// spring.main.web-application-type=none

추천

출처www.cnblogs.com/liehen2046/p/11762381.html