GH-14 - Remove Lombok from production sources.
Polished a lot of Javadoc.
This commit is contained in:
@@ -16,9 +16,9 @@
|
||||
package example.inventory;
|
||||
|
||||
import example.order.OrderCompleted;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.modulith.ApplicationModuleListener;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -27,17 +27,21 @@ import org.springframework.stereotype.Service;
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class InventoryManagement {
|
||||
|
||||
private final InventoryInternal dependency;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(InventoryManagement.class);
|
||||
|
||||
final InventoryInternal dependency;
|
||||
|
||||
InventoryManagement(InventoryInternal dependency) {
|
||||
this.dependency = dependency;
|
||||
}
|
||||
|
||||
@ApplicationModuleListener
|
||||
void on(OrderCompleted event) throws InterruptedException {
|
||||
|
||||
var orderId = event.getOrderId();
|
||||
var orderId = event.orderId();
|
||||
|
||||
LOG.info("Received order completion for {}.", orderId);
|
||||
|
||||
|
||||
@@ -15,25 +15,22 @@
|
||||
*/
|
||||
package example.inventory;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Value;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.ConstructorBinding;
|
||||
|
||||
/**
|
||||
* Some Spring Boot configuration properties exposed by the inventory.
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
@Value
|
||||
@RequiredArgsConstructor(access = AccessLevel.PACKAGE, onConstructor = @__(@ConstructorBinding))
|
||||
@ConfigurationProperties("example.inventory")
|
||||
class InventorySettings {
|
||||
record InventorySettings(int stockThreshold) {
|
||||
|
||||
/**
|
||||
* Some Javadoc.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int stockThreshold;
|
||||
public int stockThreshold() {
|
||||
return stockThreshold;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,20 +15,18 @@
|
||||
*/
|
||||
package example.order;
|
||||
|
||||
import lombok.Value;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
@Value
|
||||
public class Order {
|
||||
|
||||
private OrderIdentifier id = new OrderIdentifier(UUID.randomUUID());
|
||||
|
||||
@Value
|
||||
public static class OrderIdentifier {
|
||||
UUID id;
|
||||
public OrderIdentifier getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static record OrderIdentifier(UUID id) {}
|
||||
}
|
||||
|
||||
@@ -16,14 +16,10 @@
|
||||
package example.order;
|
||||
|
||||
import example.order.Order.OrderIdentifier;
|
||||
import lombok.Value;
|
||||
|
||||
import org.jmolecules.event.types.DomainEvent;
|
||||
|
||||
/**
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
@Value
|
||||
public class OrderCompleted implements DomainEvent {
|
||||
OrderIdentifier orderId;
|
||||
}
|
||||
public record OrderCompleted(OrderIdentifier orderId) implements DomainEvent {}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package example.order;
|
||||
|
||||
import example.order.internal.OrderInternal;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -26,11 +25,16 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class OrderManagement {
|
||||
|
||||
private final ApplicationEventPublisher events;
|
||||
private final OrderInternal dependency;
|
||||
final ApplicationEventPublisher events;
|
||||
final OrderInternal dependency;
|
||||
|
||||
OrderManagement(ApplicationEventPublisher events, OrderInternal dependency) {
|
||||
|
||||
this.events = events;
|
||||
this.dependency = dependency;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void complete(Order order) {
|
||||
|
||||
Reference in New Issue
Block a user