Changeset efdb71a for src/main/java/it/finki/tinki
- Timestamp:
- 01/03/21 23:57:21 (4 years ago)
- Branches:
- master
- Children:
- 29c0ed0
- Parents:
- 7987457
- Location:
- src/main/java/it/finki/tinki
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/tinki/bootstrap/DataHolder.java
r7987457 refdb71a 1 1 package it.finki.tinki.bootstrap; 2 3 import it.finki.tinki.model.Skill; 4 import it.finki.tinki.repository.SkillRepository; 5 import org.springframework.stereotype.Component; 2 6 3 7 import javax.annotation.PostConstruct; 4 8 9 @Component 5 10 public class DataHolder { 6 11 12 SkillRepository skillRepository; 13 14 public DataHolder(SkillRepository skillRepository) { 15 this.skillRepository = skillRepository; 16 } 17 18 @PostConstruct 19 public void init(){ 20 if(skillRepository.findAll().size()==0){ 21 Skill s1 = new Skill("C++"); 22 Skill s2 = new Skill("Java"); 23 Skill s3 = new Skill("Python"); 24 Skill s4 = new Skill("JavaScript"); 25 Skill s5 = new Skill("React"); 26 Skill s6 = new Skill("Spring"); 27 Skill s7 = new Skill("C#"); 28 Skill s8 = new Skill(".NET"); 29 Skill s9 = new Skill("NodeJs"); 30 Skill s0 = new Skill("Go"); 31 32 skillRepository.save(s1); 33 skillRepository.save(s2); 34 skillRepository.save(s3); 35 skillRepository.save(s4); 36 skillRepository.save(s5); 37 skillRepository.save(s6); 38 skillRepository.save(s7); 39 skillRepository.save(s8); 40 skillRepository.save(s9); 41 skillRepository.save(s0); 42 } 43 } 44 7 45 } -
src/main/java/it/finki/tinki/controller/TestController.java
r7987457 refdb71a 35 35 List<Skill> user = new ArrayList<>(); 36 36 37 //user.add(new Skill("C++"));38 37 user.add(new Skill("Java")); 39 38 user.add(new Skill("Python"));
Note:
See TracChangeset
for help on using the changeset viewer.