From e065fa125eb5708a2acadfd729332b8c5d740ea1 Mon Sep 17 00:00:00 2001 From: Sofiene BEN KHEMIS Date: Wed, 24 Mar 2021 19:21:49 +0100 Subject: [PATCH] Launcher --- ms-launcher/pom.xml | 69 +++++++++++++++++++ .../java/org/example/LibraryApplication.java | 13 ++++ .../org/example/configuration/BookConfig.java | 22 ++++++ .../src/main/resources/application.properties | 1 + ms-launcher/src/main/resources/data.sql | 7 ++ 5 files changed, 112 insertions(+) create mode 100644 ms-launcher/pom.xml create mode 100644 ms-launcher/src/main/java/org/example/LibraryApplication.java create mode 100644 ms-launcher/src/main/java/org/example/configuration/BookConfig.java create mode 100644 ms-launcher/src/main/resources/application.properties create mode 100644 ms-launcher/src/main/resources/data.sql diff --git a/ms-launcher/pom.xml b/ms-launcher/pom.xml new file mode 100644 index 0000000..b1ce3a7 --- /dev/null +++ b/ms-launcher/pom.xml @@ -0,0 +1,69 @@ + + + + ms-library + org.example + 1.0-SNAPSHOT + + 4.0.0 + + ms-launcher + + + + org.example + domain + ${project.version} + + + org.example + application + ${project.version} + + + org.example + infrastructure + ${project.version} + + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + org.projectlombok + lombok + true + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + \ No newline at end of file diff --git a/ms-launcher/src/main/java/org/example/LibraryApplication.java b/ms-launcher/src/main/java/org/example/LibraryApplication.java new file mode 100644 index 0000000..64ac370 --- /dev/null +++ b/ms-launcher/src/main/java/org/example/LibraryApplication.java @@ -0,0 +1,13 @@ +package org.example; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class LibraryApplication { + + public static void main(String[] args) { + SpringApplication.run(LibraryApplication.class, args); + } + +} diff --git a/ms-launcher/src/main/java/org/example/configuration/BookConfig.java b/ms-launcher/src/main/java/org/example/configuration/BookConfig.java new file mode 100644 index 0000000..d07a0d6 --- /dev/null +++ b/ms-launcher/src/main/java/org/example/configuration/BookConfig.java @@ -0,0 +1,22 @@ +package org.example.configuration; + +import org.example.adapters.BookJpaAdapter; +import org.exemple.ports.api.BookServicePort; +import org.exemple.ports.spi.BookPersistencePort; +import org.exemple.service.BookServiceImpl; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class BookConfig { + + @Bean + public BookPersistencePort bookPersistence(){ + return new BookJpaAdapter(); + } + + @Bean + public BookServicePort bookService(){ + return new BookServiceImpl(bookPersistence()); + } +} diff --git a/ms-launcher/src/main/resources/application.properties b/ms-launcher/src/main/resources/application.properties new file mode 100644 index 0000000..f620381 --- /dev/null +++ b/ms-launcher/src/main/resources/application.properties @@ -0,0 +1 @@ +server.port=8090 diff --git a/ms-launcher/src/main/resources/data.sql b/ms-launcher/src/main/resources/data.sql new file mode 100644 index 0000000..2182001 --- /dev/null +++ b/ms-launcher/src/main/resources/data.sql @@ -0,0 +1,7 @@ +insert into BOOK (id, title, description, price) values (1,'Clean Code','A handbook of agile Software',30); +insert into BOOK (id, title, description, price) values (2,'Playing with Java Microservices','Microservices Book',20); +insert into BOOK (id, title, description, price) values (3,'Spring in actions','spring Book',25); +insert into BOOK (id, title, description, price) values (4,'Head First java','java book',25); +insert into BOOK (id, title, description, price) values (5,'Hands-on spring boot','spring boot book',40); + +