Skip to content
Snippets Groups Projects
Commit d0e3d5d6 authored by Wissem BENSIDHOUM's avatar Wissem BENSIDHOUM
Browse files

remove hello-world webapp

parent 930706c6
Branches
No related tags found
No related merge requests found
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
target
dist
tmp
out-tsc
# Only exists if Bazel was run
bazel-out
# dependencies
node_modules
# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
# IDEs and editors
.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
.sass-cache
connect.lock
coverage
libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
typings
# System Files
.DS_Store
Thumbs.db
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.3.4.RELEASE/maven-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.3.4.RELEASE/maven-plugin/reference/html/#build-image)
* [Spring Web](https://docs.spring.io/spring-boot/docs/2.3.4.RELEASE/reference/htmlsingle/#boot-features-developing-web-applications)
* [Spring Data JPA](https://docs.spring.io/spring-boot/docs/2.3.4.RELEASE/reference/htmlsingle/#boot-features-jpa-and-spring-data)
* [Thymeleaf](https://docs.spring.io/spring-boot/docs/2.3.4.RELEASE/reference/htmlsingle/#boot-features-spring-mvc-template-engines)
### Guides
The following guides illustrate how to use some features concretely:
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/)
* [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
* [Handling Form Submission](https://spring.io/guides/gs/handling-form-submission/)
# Training Spring Boot
1. Importe le projet dans IntelliJ IDEA en important le fichier "pom.xml" à la racine de ce répertoire
2. Lance et init la bdd avant de run le projet<br>
(besoin du coup de pouce ? [III. SetUp de la BDD via Docker](https://github.com/resourcepool/training-spring-boot/tree/readme-setup#iii-setup-de-la-bdd-via-docker))
```
docker-compose up
```
3. Connecte la bdd à IntelliJ via l'onglet Database épinglé à droite.<br>
(besoin du coup de pouce ? [III.2. Afficher la BDD dans Intellij](https://github.com/resourcepool/training-spring-boot/tree/readme-setup#2-afficher-la-bdd-dans-intellij))
4. Lance les scripts sql contenus dans le dossier `/initdb` : Sélectionne les fichiers .sql, clique droit puis 'Run'.<br>
(besoin du coup de pouce ? [III.3. Initialisation de la BDD](https://github.com/resourcepool/training-spring-boot/tree/readme-setup#3-initialisation-de-la-bdd))
5. Lance l'application via IntelliJ, et vérifie qu'elle fonctionne ! (sur http://localhost:8080 par défaut).<br>
(besoin du coup de pouce ? [IV. Run du projet (c'est bientôt fini promis !)](https://github.com/resourcepool/training-spring-boot/tree/readme-setup#iv-run-du-projet-cest-bientôt-fini-promis-))
version: '3.1'
services:
database:
container_name: webapp-hello-word-database
image: postgres
environment:
POSTGRES_USER : root
POSTGRES_PASSWORD: toor
POSTGRES_DB: default-database
ports:
- "5432:5432"
create table users
(
id SERIAL PRIMARY KEY,
first_name TEXT not null,
last_name TEXT not null,
age int null
);
INSERT INTO users (id, first_name, last_name, age) VALUES (1, 'Paul', 'Harrohide', 20);
INSERT INTO users (id, first_name, last_name, age) VALUES (2, 'Harry', 'Covert', 25);
INSERT INTO users (id, first_name, last_name, age) VALUES (3, 'Alain', 'Posteur', null);
INSERT INTO users (id, first_name, last_name, age) VALUES (4, 'Elvire', 'Debord', null);
INSERT INTO users (id, first_name, last_name, age) VALUES (5, 'Laurent', 'Barre', 41);
INSERT INTO users (id, first_name, last_name, age) VALUES (6, 'Homer', 'Cipourtoux', 28);
INSERT INTO users (id, first_name, last_name, age) VALUES (7, 'Gaston', 'Laplouz', null);
INSERT INTO users (id, first_name, last_name, age) VALUES (8, 'Gisèle', 'Detable', null);
INSERT INTO users (id, first_name, last_name, age) VALUES (9, 'Thomas', 'Ouaque', null);
INSERT INTO users (id, first_name, last_name, age) VALUES (10, 'Sacha', 'Telfrize', 23);
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>fr.epf</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package io.takima.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import javax.annotation.PostConstruct;
@SpringBootApplication
public class HelloWorldApplication {
public static void main(String[] args) {
SpringApplication.run(HelloWorldApplication.class, args);
}
@PostConstruct
public void init() {
System.out.println("---------------------------------------");
System.out.println("---------------------------------------");
System.out.println("Hello World!");
System.out.println("Félicitations, votre setup fonctionne parfaitement.");
System.out.println("Vous pouvez maintenant supprimer ce projet.");
System.out.println("---------------------------------------");
System.out.println("---------------------------------------");
}
}
spring.datasource.url=jdbc:postgresql://localhost:5432/default-database
spring.datasource.username=root
spring.datasource.password=toor
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment