Giter Site home page Giter Site logo

codelytv / java-ddd-example-deprecated Goto Github PK

View Code? Open in Web Editor NEW
291.0 18.0 136.0 138 KB

☕🎯 Hexagonal Architecture + DDD + CQRS in a Java project using SpringBoot

Java 100.00%
cqrs codelytv ddd java spring-boot domain-driven-design hexagonal-architecture testing bounded-context bounded-contexts

java-ddd-example-deprecated's Introduction

⚠️ Deprecated project. Go to https://github.com/CodelyTV/java-ddd-example to see to the new one.

☕🎯 Hexagonal Architecture + DDD + CQRS Java example with SpringBoot

You can do awesome stuff with Java 🙂

CodelyTV Build Status

Implementation example of a Java application following Domain-Driven Design (DDD) and Command Query Responsibility Segregation (CQRS) principles, keeping the code as simple as possible.

Take a look, play and have fun with it!

🚀 Environment setup

  1. Install Java: brew cask install java
  2. Clone this repository: git clone https://github.com/CodelyTV/cqrs-ddd-java-example
  3. Execute some Gradle lifecycle tasks in order to check everything is OK:
    1. Create the project JAR and other project artifacts: ./gradlew assemble --warning-mode all
    2. Run the tests and plugins verification tasks: ./gradlew check --warning-mode all
    3. Execute the main application entrypoint: ./gradlew run --warning-mode all
  4. Start developing!

🤔 How to update dependencies

🤝 Contributing

There are a lot of missing things (add swagger/OpenAPI, improve documentation...), feel free to add them if you want!

java-ddd-example-deprecated's People

Contributors

javiercane avatar rgomezcasas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-ddd-example-deprecated's Issues

Add DB

Add the needed infrastructure in order to save to an actual MySQL database.

Issue blocked by the Docker Compose infrastructure added in the ELK issue

Add Spring Boot

Add Spring Boot in order to bootstrap the application in terms of:

  • DIC
  • Routing management
  • Controllers

Error con hibernate usando docker JAR

Descripción

Estoy comenzando a aplicar DDD en un proyecto ya funcional. Hasta el momento logre hacer funcionar correctamente una simple búsqueda de datos en la BD implementado la abstracción de hibernate usando los archivo hbm.xml.

Al momento de intentar ejecutar el mismo en docker el mismo falla al buscar los resultados de la BD con el siguiente error:

company-notification | 2021-02-19 18:04:18.636 ERROR 1 --- [nio-8080-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.remax.notification.aggregates.shared.domain.bus.query.QueryHandlerExecutionError: java.lang.IllegalArgumentException: Not an entity: class com.company.notification.aggregates.notification_type.domain.NotificationType] with root cause
company-notification | java.lang.IllegalArgumentException: Not an entity: class com.company.notification.aggregates.notification_type.domain.NotificationType
company-notification | at org.hibernate.metamodel.internal.MetamodelImpl.entity(MetamodelImpl.java:566) ~[hibernate-core-5.4.9.Final.jar!/:5.4.9.Final]
company-notification | at org.hibernate.query.criteria.internal.QueryStructure.from(QueryStructure.java:127) ~[hibernate-core-5.4.9.Final.jar!/:5.4.9.Final]
company-notification | at org.hibernate.query.criteria.internal.CriteriaQueryImpl.from(CriteriaQueryImpl.java:154) ~[hibernate-core-5.4.9.Final.jar!/:5.4.9.Final]

Posible causa

Estoy casi seguro que es por debido a la función searchMappingFiles que no encuentra los archivos de definición y al recuperar no encuentra una entidad para tales datos.

Config

DockerFile

FROM amazoncorretto:11
VOLUME /tmp
COPY build/libs/*.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

Quisiera análisis los dominios, pero no los encuentro

Hola chicos, ante todo excelente trabajo que hacen con su canal, compartí mí agradecimiento por como comparten conocimiento.

Estoy destilando DDD, paso a paso con el libro aunque quiero empezar a entender mucho más aspectos. Entonces quisiera ver el diseño de los dominios que tiene como ejemplo pero veo que no están en el repo. Pueden compartir ese info?

Create Request/Response DTOs for Application Services

What

Instead of instantiating the Value Objects directly from the controller, we should instantiate a DTO such as SignUpUserRequest and pass it to the Application Service.

The Application Services intended for querying data, we should return also a DTO such as UserResponse.

Why

This way we:

  • Avoid coupling our entry points to the internal details on how we model out our domain (UserId value objects and so on).
  • Leave the code on the Hexagonal Architecture approach closer to what we'll do while evolving to an architecture applying CQRS concepts. We will only need to:
    • Replace the XxxRequest by their corresponding XxxCommand,
    • Send the commands to the Command Bus instead of directly calling the Application Service
    • Implement the Command Handler in order to extract each one of the scalar values from the Command, convert them to Value Object instances, and call to the Application Service
    • Modify the Application Service in order to directly receive the Value Objects instead of the XxxRequest

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.