reformatted as per standard formatter and incorporated review comments.

This commit is contained in:
ajay74984 2020-02-15 09:32:50 +01:00
parent 7feb7bf9d8
commit d868eda952
12 changed files with 143 additions and 161 deletions

View File

@ -42,24 +42,6 @@
<classifier>exec</classifier>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -3,7 +3,7 @@ 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;

View File

@ -1,11 +1,10 @@
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")

View File

@ -7,15 +7,17 @@ public class Document {
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;
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -1,10 +0,0 @@
package com.baeldung.port;
import com.baeldung.domain.Document;
public interface DocumentRepo {
void storeDocument(Document document);
Document findDocumentById(String id);
}

View File

@ -1,11 +0,0 @@
package com.baeldung.port;
import com.baeldung.domain.Document;
public interface DocumentService {
void createDocument(Document document);
Document findById(String id);
}

View File

@ -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);
}
}