Skip to content

Commit f10b578

Browse files
author
Ivan Franchin
committed
remove mapstruct to keep the project simpler
1 parent 282f655 commit f10b578

File tree

4 files changed

+4
-52
lines changed

4 files changed

+4
-52
lines changed

bitcoin-api/pom.xml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
<description>Demo project for Spring Boot</description>
1515

1616
<properties>
17-
<org.mapstruct.version>1.5.3.Final</org.mapstruct.version>
18-
<lombok-mapstruct-binding.version>0.2.0</lombok-mapstruct-binding.version>
1917
<springdoc-openapi.version>2.0.4</springdoc-openapi.version>
2018
</properties>
2119

@@ -57,13 +55,6 @@
5755
<artifactId>spring-kafka</artifactId>
5856
</dependency>
5957

60-
<!-- MapStruct -->
61-
<dependency>
62-
<groupId>org.mapstruct</groupId>
63-
<artifactId>mapstruct</artifactId>
64-
<version>${org.mapstruct.version}</version>
65-
</dependency>
66-
6758
<!-- SpringDoc OpenApi -->
6859
<dependency>
6960
<groupId>org.springdoc</groupId>
@@ -112,29 +103,6 @@
112103
</excludes>
113104
</configuration>
114105
</plugin>
115-
<plugin>
116-
<groupId>org.apache.maven.plugins</groupId>
117-
<artifactId>maven-compiler-plugin</artifactId>
118-
<configuration>
119-
<annotationProcessorPaths>
120-
<path>
121-
<groupId>org.projectlombok</groupId>
122-
<artifactId>lombok</artifactId>
123-
<version>${lombok.version}</version>
124-
</path>
125-
<path>
126-
<groupId>org.projectlombok</groupId>
127-
<artifactId>lombok-mapstruct-binding</artifactId>
128-
<version>${lombok-mapstruct-binding.version}</version>
129-
</path>
130-
<path>
131-
<groupId>org.mapstruct</groupId>
132-
<artifactId>mapstruct-processor</artifactId>
133-
<version>${org.mapstruct.version}</version>
134-
</path>
135-
</annotationProcessorPaths>
136-
</configuration>
137-
</plugin>
138106
</plugins>
139107
</build>
140108

bitcoin-api/src/main/java/com/ivanfranchin/bitcoinapi/kafka/PriceStreamer.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.ivanfranchin.bitcoinapi.kafka;
22

33
import com.ivanfranchin.bitcoinapi.model.Price;
4-
import com.ivanfranchin.bitcoinapi.mapper.PriceMapper;
54
import lombok.RequiredArgsConstructor;
65
import lombok.extern.slf4j.Slf4j;
76
import org.springframework.cloud.stream.function.StreamBridge;
@@ -12,11 +11,10 @@
1211
@Component
1312
public class PriceStreamer {
1413

15-
private final PriceMapper priceMapper;
1614
private final StreamBridge streamBridge;
1715

1816
public void send(Price price) {
19-
PriceMessage priceMessage = priceMapper.toPriceMessage(price);
17+
PriceMessage priceMessage = new PriceMessage(price.getId(), price.getValue(), price.getTimestamp());
2018
streamBridge.send("prices-out-0", priceMessage);
2119
log.info("{} sent to bus.", priceMessage);
2220
}

bitcoin-api/src/main/java/com/ivanfranchin/bitcoinapi/mapper/PriceMapper.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

bitcoin-api/src/main/java/com/ivanfranchin/bitcoinapi/rest/PriceController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.ivanfranchin.bitcoinapi.rest;
22

3-
import com.ivanfranchin.bitcoinapi.mapper.PriceMapper;
3+
import com.ivanfranchin.bitcoinapi.model.Price;
44
import com.ivanfranchin.bitcoinapi.rest.dto.PriceResponse;
55
import com.ivanfranchin.bitcoinapi.service.PriceService;
66
import io.swagger.v3.oas.annotations.Operation;
@@ -15,11 +15,11 @@
1515
public class PriceController {
1616

1717
private final PriceService priceService;
18-
private final PriceMapper priceMapper;
1918

2019
@Operation(summary = "Get last price")
2120
@GetMapping("/last")
2221
public PriceResponse getLastPrice() {
23-
return priceMapper.toPriceResponse(priceService.getLastPrice());
22+
Price price = priceService.getLastPrice();
23+
return new PriceResponse(price.getValue(), price.getTimestamp());
2424
}
2525
}

0 commit comments

Comments
 (0)