Skip to content
Snippets Groups Projects
Commit 31b55cba authored by Laurine's avatar Laurine
Browse files

1- Startup & 2- Create User

parent 8f09bc41
No related branches found
No related tags found
No related merge requests found
......@@ -17,14 +17,14 @@
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-jpa</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-web</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
......
package com.example.livecodingjavaspring;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import static java.lang.Integer.parseInt;
public class App {
public static void main(String[] args) {
System.out.println("Hello word");
List<User> users = new ArrayList<>();
users.add(new User("Laurine", "LE NET", 24));
users.add(new User("Pilou", "BERTRAND", 24));
users.add(new User("Alain", "CONNU", 26));
users.add(new User("Aurélie", "BIENCEQUETAECRIT", 20));
users.add(new User("Barack", "AFFRITTE", 22));
users.add(new User("Camille", "ONETTE", 23));
users.add(new User("Jean", "TENRIEN", 22));
users.add(new User("Lara", "TATOUILLE", 24));
users.forEach(System.out::println);
}
}
package com.example.livecodingjavaspring;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class LiveCodingJavaSpringApplication {
public static void main(String[] args) {
SpringApplication.run(LiveCodingJavaSpringApplication.class, args);
}
}
package com.example.livecodingjavaspring;
public class User {
private String firstName;
private String lastName;
private Integer age;
public User(String firstName, String lastName, Integer age) {
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
}
@Override
public String toString() {
return "User{" +
"firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", age=" + age +
'}';
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment