Skip to content

Instantly share code, notes, and snippets.

@YooWaan
Created February 7, 2016 15:16
Show Gist options
  • Save YooWaan/2acbecb8f668eea105b0 to your computer and use it in GitHub Desktop.
Save YooWaan/2acbecb8f668eea105b0 to your computer and use it in GitHub Desktop.
package jp.plainworks.nokizal.appserv.tool;
import java.util.TimeZone;
import org.springframework.boot.SpringApplication;
import org.springframework.stereotype.Component;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.boot.orm.jpa.EntityScan;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
@Configuration
@ComponentScan(basePackages = {"xxxxxx"})
@EnableJpaRepositories(basePackages="xxxxxxx")
@EntityScan(basePackages="xxxxx")
@Component
@EnableAutoConfiguration
public class CmdMain implements CommandLineRunner, ExitCodeGenerator {
@Autowired ApplicationContext context;
// exit code provider
Integer exitCode = Integer.valueOf(-1);
public static void main(String[] args) throws Exception {
SpringApplication app = new SpringApplication(ToolMain.class);
app.setWebEnvironment(false);
app.setShowBanner(false);
app.run(args);
}
@Override
public void run(String ... args) {
// do some thing
}
@Override
public int getExitCode() {
return this.exitCode.intValue();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment