Skip to content

Commit c17f476

Browse files
committed
Showcase stereotyping.
1 parent f8ef076 commit c17f476

File tree

22 files changed

+441
-8
lines changed

22 files changed

+441
-8
lines changed

server/pom.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
1919
<bytebuddy.version>1.17.6</bytebuddy.version>
2020
<datasource-micrometer.version>1.1.0</datasource-micrometer.version>
2121
<java.version>21</java.version>
22-
<jmolecules.version>2025.0.0-SNAPSHOT</jmolecules.version>
22+
<jmolecules.version>2025.0.0-STEREOTYPE-SNAPSHOT</jmolecules.version>
2323
<spring-hateoas.version>3.0.0-SNAPSHOT</spring-hateoas.version>
2424
<spring-modulith.version>2.0.0-SNAPSHOT</spring-modulith.version>
2525

@@ -65,6 +65,21 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
6565
<artifactId>jmolecules-starter-ddd</artifactId>
6666
</dependency>
6767

68+
<dependency>
69+
<groupId>org.jmolecules</groupId>
70+
<artifactId>jmolecules-ddd</artifactId>
71+
</dependency>
72+
73+
<dependency>
74+
<groupId>org.jmolecules</groupId>
75+
<artifactId>jmolecules-hexagonal-architecture</artifactId>
76+
</dependency>
77+
78+
<dependency>
79+
<groupId>org.jmolecules.integrations</groupId>
80+
<artifactId>jmolecules-stereotype</artifactId>
81+
</dependency>
82+
6883
<dependency>
6984
<groupId>org.jmolecules.integrations</groupId>
7085
<artifactId>jmolecules-jpa</artifactId>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package de.odrotbohm.restbucks;
17+
18+
import org.jmolecules.stereotype.Stereotype;
19+
20+
/**
21+
* @author Oliver Drotbohm
22+
*/
23+
@Stereotype(groups = "restbucks")
24+
public interface DTO {}

server/src/main/java/de/odrotbohm/restbucks/dashboard/Dashboard.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import javax.money.MonetaryAmount;
2727

2828
import org.javamoney.moneta.Money;
29+
import org.jmolecules.architecture.hexagonal.PrimaryAdapter;
2930
import org.springframework.data.rest.webmvc.RepositoryLinksResource;
3031
import org.springframework.hateoas.server.RepresentationModelProcessor;
3132
import org.springframework.modulith.events.ApplicationModuleListener;
@@ -42,6 +43,7 @@
4243
*
4344
* @author Oliver Drotbohm
4445
*/
46+
@PrimaryAdapter
4547
@RestController
4648
@RequiredArgsConstructor
4749
class Dashboard implements RepresentationModelProcessor<RepositoryLinksResource> {

server/src/main/java/de/odrotbohm/restbucks/drinks/Drinks.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import de.odrotbohm.restbucks.drinks.Drink.DrinkIdentifier;
1919

20+
import org.jmolecules.architecture.hexagonal.SecondaryPort;
2021
import org.jspecify.annotations.Nullable;
2122
import org.springframework.data.domain.Sort;
2223
import org.springframework.data.repository.CrudRepository;
@@ -25,6 +26,7 @@
2526
/**
2627
* @author Oliver Drotbohm
2728
*/
29+
@SecondaryPort
2830
public interface Drinks extends CrudRepository<Drink, DrinkIdentifier> {
2931

3032
@Nullable

server/src/main/java/de/odrotbohm/restbucks/drinks/DrinksModelProcessor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import java.util.Optional;
2121

22+
import org.jmolecules.architecture.hexagonal.PrimaryAdapter;
2223
import org.springframework.hateoas.CollectionModel;
2324
import org.springframework.hateoas.EntityModel;
2425
import org.springframework.hateoas.server.RepresentationModelProcessor;
@@ -28,6 +29,7 @@
2829
* @author Oliver Drotbohm
2930
*/
3031
@Component
32+
@PrimaryAdapter
3133
class DrinksModelProcessor implements RepresentationModelProcessor<CollectionModel<EntityModel<Drink>>> {
3234

3335
/*

server/src/main/java/de/odrotbohm/restbucks/drinks/DrinksOptions.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import java.util.Optional;
2323

24+
import org.jmolecules.architecture.hexagonal.PrimaryAdapter;
2425
import org.springframework.data.rest.webmvc.BasePathAwareController;
2526
import org.springframework.hateoas.LinkRelation;
2627
import org.springframework.hateoas.mediatype.hal.HalLinkRelation;
@@ -37,6 +38,7 @@
3738
/**
3839
* @author Oliver Drotbohm
3940
*/
41+
@PrimaryAdapter
4042
@BasePathAwareController
4143
public class DrinksOptions {
4244

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
@org.jspecify.annotations.NullMarked
2+
@org.jmolecules.architecture.hexagonal.Application
23
package de.odrotbohm.restbucks.drinks;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
@org.jspecify.annotations.NullMarked
2+
@org.jmolecules.architecture.hexagonal.Application
23
package de.odrotbohm.restbucks.engine;

server/src/main/java/de/odrotbohm/restbucks/order/OrderProjection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/**
2525
* Projection interface to render {@link Order} summaries.
26-
*
26+
*
2727
* @author Oliver Gierke
2828
*/
2929
@Projection(name = "summary", types = Order.class)

server/src/main/java/de/odrotbohm/restbucks/order/Orders.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import java.util.List;
2222

23+
import org.jmolecules.architecture.hexagonal.SecondaryPort;
2324
import org.jmolecules.ddd.integration.AssociationResolver;
2425
import org.springframework.data.repository.CrudRepository;
2526
import org.springframework.data.repository.PagingAndSortingRepository;
@@ -32,6 +33,7 @@
3233
*
3334
* @author Oliver Gierke
3435
*/
36+
@SecondaryPort
3537
@RepositoryRestResource(excerptProjection = OrderProjection.class)
3638
public interface Orders extends CrudRepository<Order, OrderIdentifier>,
3739
AssociationResolver<Order, OrderIdentifier>,

0 commit comments

Comments
 (0)