Spring Boot — Runners | Code Factory

Application Runner

package com.codeFactory;import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootFileUploadApplication implements ApplicationRunner {
public static void main(String[] args) {
SpringApplication.run(SpringBootFileUploadApplication.class, args);
}
@Override
public void run(ApplicationArguments args) throws Exception {
System.out.println("ApplicationRunner");
}
}

Command Line Runner

package com.codeFactory;import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootFileUploadApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(SpringBootFileUploadApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
System.out.println("CommandLineRunner");
}
}

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Hack Day Spotlight: CB Insights Office In Minecraft

Text Matching with FuzzyWuzzy

Top 10 Most Promising Banking Analytics Solution Providers | Evolven

Sasha Gilenson, Founder & CEO

Updating Magento 2 development dependencies

Build an App Like Lego — Tutorial 7

Infrastructure as Code: Terraform

Multiple scenarios with Push Notification in iOS

Laravel vs WordPress: Which is faster?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Code Factory

Code Factory

More from Medium

Decorator Design Pattern

NoSuchBeanDefinitionException — 2 Ways to Resolve this Issue in SpringBoot Application

Can there be static imports in Java

Data Types in JVM