-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathDemoApplication.java
More file actions
31 lines (26 loc) · 1.08 KB
/
DemoApplication.java
File metadata and controls
31 lines (26 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.example;
import com.example.model.ToDo;
import com.example.repository.ToDoRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class DemoApplication {
private static final Logger logger = LoggerFactory.getLogger(DemoApplication.class);
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@Bean
public CommandLineRunner setup(ToDoRepository toDoRepository) {
return (args) -> {
toDoRepository.save(new ToDo("Remove unused imports", true));
toDoRepository.save(new ToDo("Clean the code", true));
toDoRepository.save(new ToDo("Build the artifacts", false));
toDoRepository.save(new ToDo("Deploy the jar file", true));
logger.info("The sample data has been generated");
};
}
}