|
1 | 1 | package org.woehlke.learn.learnneo4j; |
2 | 2 |
|
3 | | -import org.springframework.beans.factory.annotation.Autowired; |
4 | | -import org.springframework.boot.CommandLineRunner; |
| 3 | + |
5 | 4 | import org.springframework.boot.SpringApplication; |
6 | | -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
7 | 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 6 | +/* |
| 7 | +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; |
| 9 | +import org.springframework.boot.CommandLineRunner; |
8 | 10 | import org.springframework.context.annotation.ComponentScan; |
9 | 11 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; |
10 | 12 | import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories; |
|
13 | 15 | import org.springframework.web.servlet.config.annotation.EnableWebMvc; |
14 | 16 | import org.woehlke.learn.learnneo4j.model.Category; |
15 | 17 | import org.woehlke.learn.learnneo4j.model.category.CategoryRepository; |
16 | | - |
17 | | - |
| 18 | +*/ |
| 19 | +/* |
18 | 20 | @ComponentScan({"org.woehlke.learn.learnneo4j.model","org.woehlke.learn.learnneo4j.components"}) |
19 | 21 | @EnableJpaRepositories({"org.woehlke.learn.learnneo4j.components.db"}) |
20 | 22 | @EnableNeo4jRepositories({"org.woehlke.learn.learnneo4j.model","org.woehlke.learn.learnneo4j.components"}) |
21 | 23 | @EnableAutoConfiguration |
22 | 24 | @EnableWebMvc |
23 | 25 | @EnableTransactionManagement |
24 | 26 | @EnableSpringDataWebSupport |
| 27 | +*/ |
25 | 28 | @SpringBootApplication |
26 | | -public class LearnNeo4jApplication implements CommandLineRunner { |
| 29 | +public class LearnNeo4jApplication { |
27 | 30 |
|
28 | | - @Autowired |
29 | | - private CategoryRepository categoryRepository; |
30 | 31 |
|
31 | 32 | public static void main(String[] args) { |
32 | 33 | SpringApplication.run(LearnNeo4jApplication.class, args); |
33 | 34 | } |
34 | 35 |
|
35 | | - @Override |
36 | | - public void run(String... args) throws Exception { |
37 | | - this.categoryRepository.deleteAll(); |
38 | | - this.categoryRepository.save(new Category("www")); |
39 | | - this.categoryRepository.save(new Category("qt4")); |
40 | | - this.categoryRepository.save(new Category("qt5")); |
41 | | - // fetch all Categories |
42 | | - System.out.println("Categories found with findAll():"); |
43 | | - System.out.println("--------------------------------"); |
44 | | - for (Category category : this.categoryRepository.findAll()) { |
45 | | - System.out.println(category); |
46 | | - } |
47 | | - System.out.println(); |
48 | | - // fetch an individual Category |
49 | | - System.out.println("Category found with findByCategory('www'):"); |
50 | | - System.out.println("--------------------------------"); |
51 | | - System.out.println(this.categoryRepository.findByName("www")); |
52 | | - } |
53 | 36 | } |
0 commit comments