diff --git a/spring-boot-modules/spring-boot-hexagonal/pom.xml b/spring-boot-modules/spring-boot-hexagonal/pom.xml
index 54d61fa806..c4ff36c2cf 100644
--- a/spring-boot-modules/spring-boot-hexagonal/pom.xml
+++ b/spring-boot-modules/spring-boot-hexagonal/pom.xml
@@ -1,70 +1,52 @@
- 4.0.0
- spring-boot-hexagonal
- spring-boot-hexagonal
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ 4.0.0
+ spring-boot-hexagonal
+ spring-boot-hexagonal
-
- com.baeldung
- parent-boot-2
- 0.0.1-SNAPSHOT
- ../../parent-boot-2
-
+
+ com.baeldung
+ parent-boot-2
+ 0.0.1-SNAPSHOT
+ ../../parent-boot-2
+
-
-
- org.springframework.boot
- spring-boot-starter-web
-
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
-
- org.springframework.boot
- spring-boot-starter-test
-
+
+ org.springframework.boot
+ spring-boot-starter-test
+
-
+
-
- spring-boot-hexagonal
-
-
- src/main/resources
- true
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- exec
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
-
-
- jar-with-dependencies
-
-
-
-
- make-assembly
- package
-
- single
-
-
-
-
-
-
+
+ spring-boot-hexagonal
+
+
+ src/main/resources
+ true
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ exec
+
+
+
+
-
- UTF-8
-
+
+ UTF-8
+
diff --git a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/Application.java b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/Application.java
index a898f9cf05..37dbe7dab8 100644
--- a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/Application.java
+++ b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/Application.java
@@ -5,9 +5,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
-
- public static void main(String[] args) {
- SpringApplication.run(Application.class, args);
- }
-
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
}
diff --git a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/adapter/DocumentRepositoryImpl.java b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/adapter/DocumentRepositoryImpl.java
index 1248133665..32414442ef 100644
--- a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/adapter/DocumentRepositoryImpl.java
+++ b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/adapter/DocumentRepositoryImpl.java
@@ -3,23 +3,23 @@ package com.baeldung.adapter;
import org.springframework.stereotype.Repository;
import com.baeldung.domain.Document;
-import com.baeldung.port.DocumentRepo;
+import com.baeldung.domain.port.DocumentRepo;
import java.util.HashMap;
import java.util.Map;
@Repository
public class DocumentRepositoryImpl implements DocumentRepo {
-
- private Map documentMap = new HashMap<>();
-
- @Override
- public void storeDocument(Document document) {
- documentMap.put(document.getId(), document);
- }
-
- @Override
- public Document findDocumentById(String id) {
- return documentMap.get(id);
- }
+
+ private Map documentMap = new HashMap<>();
+
+ @Override
+ public void storeDocument(Document document) {
+ documentMap.put(document.getId(), document);
+ }
+
+ @Override
+ public Document findDocumentById(String id) {
+ return documentMap.get(id);
+ }
}
diff --git a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/adapter/DocumentRestAdapter.java b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/adapter/DocumentRestAdapter.java
index e7fa5d0b42..985a5257c0 100644
--- a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/adapter/DocumentRestAdapter.java
+++ b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/adapter/DocumentRestAdapter.java
@@ -1,26 +1,25 @@
package com.baeldung.adapter;
-
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.baeldung.domain.Document;
-import com.baeldung.port.DocumentService;
+import com.baeldung.domain.port.DocumentService;
@RestController
@RequestMapping("/doc")
public class DocumentRestAdapter {
- @Autowired
- private DocumentService documentService;
-
- @PostMapping
- public void createDocument(@RequestBody Document document) {
- documentService.createDocument(document);
- }
-
- @GetMapping("/{id}")
- public Document findById(@PathVariable String id) {
- return documentService.findById(id);
- }
-
+ @Autowired
+ private DocumentService documentService;
+
+ @PostMapping
+ public void createDocument(@RequestBody Document document) {
+ documentService.createDocument(document);
+ }
+
+ @GetMapping("/{id}")
+ public Document findById(@PathVariable String id) {
+ return documentService.findById(id);
+ }
+
}
diff --git a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/domain/Document.java b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/domain/Document.java
index 58381d536d..24d0a95071 100644
--- a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/domain/Document.java
+++ b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/domain/Document.java
@@ -1,21 +1,23 @@
package com.baeldung.domain;
public class Document {
- private String id;
- private String data;
-
- public String getId() {
- return id;
- }
- public void setId(String id) {
- this.id = id;
- }
- public String getData() {
- return data;
- }
- public void setData(String data) {
- this.data = data;
- }
-
-
+ private String id;
+ private String data;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
}
diff --git a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/domain/port/DocumentRepo.java b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/domain/port/DocumentRepo.java
new file mode 100644
index 0000000000..001e3251e4
--- /dev/null
+++ b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/domain/port/DocumentRepo.java
@@ -0,0 +1,9 @@
+package com.baeldung.domain.port;
+
+import com.baeldung.domain.Document;
+
+public interface DocumentRepo {
+ void storeDocument(Document document);
+
+ Document findDocumentById(String id);
+}
diff --git a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/domain/port/DocumentService.java b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/domain/port/DocumentService.java
new file mode 100644
index 0000000000..009c26c01f
--- /dev/null
+++ b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/domain/port/DocumentService.java
@@ -0,0 +1,11 @@
+package com.baeldung.domain.port;
+
+import com.baeldung.domain.Document;
+
+public interface DocumentService {
+
+ void createDocument(Document document);
+
+ Document findById(String id);
+
+}
diff --git a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/domain/port/impl/DocumentServiceImpl.java b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/domain/port/impl/DocumentServiceImpl.java
new file mode 100644
index 0000000000..f5c351406e
--- /dev/null
+++ b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/domain/port/impl/DocumentServiceImpl.java
@@ -0,0 +1,25 @@
+package com.baeldung.domain.port.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.baeldung.domain.Document;
+import com.baeldung.domain.port.DocumentRepo;
+import com.baeldung.domain.port.DocumentService;
+
+@Service
+public class DocumentServiceImpl implements DocumentService {
+
+ @Autowired
+ private DocumentRepo documentRepo;
+
+ @Override
+ public void createDocument(Document document) {
+ documentRepo.storeDocument(document);
+ }
+
+ @Override
+ public Document findById(String id) {
+ return documentRepo.findDocumentById(id);
+ }
+}
diff --git a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/port/DocumentRepo.java b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/port/DocumentRepo.java
deleted file mode 100644
index 96dba3d954..0000000000
--- a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/port/DocumentRepo.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.baeldung.port;
-
-import com.baeldung.domain.Document;
-
-public interface DocumentRepo {
- void storeDocument(Document document);
-
- Document findDocumentById(String id);
-}
-
diff --git a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/port/DocumentService.java b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/port/DocumentService.java
deleted file mode 100644
index 5d5bfb2035..0000000000
--- a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/port/DocumentService.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.baeldung.port;
-
-import com.baeldung.domain.Document;
-
-public interface DocumentService {
-
- void createDocument(Document document);
-
- Document findById(String id);
-
-}
diff --git a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/port/impl/DocumentServiceImpl.java b/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/port/impl/DocumentServiceImpl.java
deleted file mode 100644
index 1b50e1efe2..0000000000
--- a/spring-boot-modules/spring-boot-hexagonal/src/main/java/com/baeldung/port/impl/DocumentServiceImpl.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.baeldung.port.impl;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.baeldung.domain.Document;
-import com.baeldung.port.DocumentRepo;
-import com.baeldung.port.DocumentService;
-
-@Service
-public class DocumentServiceImpl implements DocumentService {
-
- @Autowired
- private DocumentRepo documentRepo;
-
- @Override
- public void createDocument(Document document) {
- documentRepo.storeDocument(document);
- }
-
- @Override
- public Document findById(String id) {
- return documentRepo.findDocumentById(id);
- }
-}
diff --git a/spring-boot-modules/spring-boot-hexagonal/src/test/java/com/baeldung/ApplicationUnitTest.java b/spring-boot-modules/spring-boot-hexagonal/src/test/java/com/baeldung/ApplicationUnitTest.java
index f7592c0cc8..2ce9b1cf24 100644
--- a/spring-boot-modules/spring-boot-hexagonal/src/test/java/com/baeldung/ApplicationUnitTest.java
+++ b/spring-boot-modules/spring-boot-hexagonal/src/test/java/com/baeldung/ApplicationUnitTest.java
@@ -8,9 +8,9 @@ import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest
@RunWith(SpringRunner.class)
class ApplicationUnitTest {
-
- @Test
- public void contextLoads() {
- }
-
+
+ @Test
+ public void contextLoads() {
+ }
+
}