P02: Maven multi-module skeleton — domain, application, adapter-persistence, adapter-web, bootstrap
build / build (push) Failing after 18s
build / build (push) Failing after 18s
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent><groupId>dev.shopforge</groupId><artifactId>shopforge</artifactId><version>0.1.0-SNAPSHOT</version></parent>
|
||||
<artifactId>shopforge-application</artifactId>
|
||||
<name>ShopForge :: application</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency><groupId>dev.shopforge</groupId><artifactId>shopforge-domain</artifactId></dependency>
|
||||
<!-- sirf spring-context — DI ke liye. Web nahi, JPA nahi. -->
|
||||
<dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId></dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,7 @@
|
||||
package dev.shopforge.application;
|
||||
|
||||
public class ShopNotFound extends RuntimeException {
|
||||
public ShopNotFound(String subdomain) {
|
||||
super("Is subdomain ki koi shop nahi mili: " + subdomain);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package dev.shopforge.application;
|
||||
|
||||
import dev.shopforge.domain.Shop;
|
||||
import dev.shopforge.domain.ShopRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/** Use case. Domain ka port maangta hai — JPA ka naam tak nahi jaanta. */
|
||||
@Service
|
||||
public class ShopService {
|
||||
|
||||
private final ShopRepository shops;
|
||||
|
||||
public ShopService(ShopRepository shops) { // constructor injection — Java Doc 22
|
||||
this.shops = shops;
|
||||
}
|
||||
|
||||
public Shop bySubdomain(String subdomain) {
|
||||
return shops.bySubdomain(subdomain)
|
||||
.orElseThrow(() -> new ShopNotFound(subdomain));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user