https://start.spring.io/
|
buildscript { repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.9.RELEASE") } } |
|
plugins { id 'java' id 'idea' id 'org.springframework.boot' version '1.5.8.RELEASE' id 'io.franzbecker.gradle-lombok' version '1.11' } |
|
group 'org.ma' version '1.0-SNAPSHOT' jar { baseName = 'goal-spring-boot' version = '0.1.0' } sourceCompatibility = 1.8 repositories { mavenCentral() } |
|
dependencies { compile group: 'org.springframework.boot', name: 'spring-boot-starter', version: '1.5.8.RELEASE' compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.5.8.RELEASE' compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf', version: '1.5.8.RELEASE' compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '1.5.8.RELEASE' compile group: 'com.h2database', name: 'h2', version: '1.4.196' testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '1.5.8.RELEASE' testCompile group: 'com.github.springtestdbunit', name: 'spring-test-dbunit', version: '1.3.0' } |
put into main class
|
@SpringBootApplication // same as @Configuration @EnableAutoConfiguration @ComponentScan public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Bean public CommandLineRunner commandLineRunner(ApplicationContext ctx) { return args -> {}; } } |
CommandLineRunner ApplicationRunner @Order