//1.) i checked all imports they are correct the only error i am getting is while calling the List.of() method
UserDao user1 = new UserDao();
user1.setName("j");
user1.setUser_name("k");
user1.setPassword("l");
user1.setPhone("86632");
UserDao user2 = new UserDao();
user1.setName("j");
user1.setUser_name("k");
user1.setPassword("l");
user1.setPhone("86632");
//2.here the of method is not found in spring tool suite i am on jre1.8
List<UserDao> users = List.of(user1, user2);
Iterable<UserDao> itrb = userRepo.saveAll(users);
}
}
CodePudding user response:
List.of
is introduced starting from Java 9. So that you have to upgrade your Java to make use of one.
CodePudding user response:
You need atleast Java 9 for using List.of() function https://docs.oracle.com/javase/9/docs/api/java/util/List.html#immutable