hexagonal-architecture | A Spring Boot application | Security library
kandi X-RAY | hexagonal-architecture Summary
kandi X-RAY | hexagonal-architecture Summary
This repository contains an implementation for a Spring-based application that illustrates the hexagonal architecture in Java.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Add a product to the database
- Gets the product id
- Remove a product
- Compares this product to another
- Start the Hexagonal application
- Get the product with the given ID
- Get a list of all products
- Add a new product
- Get a product
- Returns a list of products
- Creates a unique hash code for this product
- Adds a product to the repository
- Returns the product with the given id
- Removes a Product from the repository
hexagonal-architecture Key Features
hexagonal-architecture Examples and Code Snippets
Community Discussions
Trending Discussions on hexagonal-architecture
QUESTION
for the last few months we are trying to refactor and improve the architecture and style of our back-end services based on DDD and Hexagonal-architecture. Unfortunately we are very new to DDD and its best practices.
Our product is about fleet management and monitoring. One feature we have is that users can get reports of the vehicles under their managements. Mostly these reports are simple queries on the database with some aggregations and domain logic in the application layer. This is were our problems arises. For most of application, we used CQRS and defined command/query handlers in our application layer. Dependencies our injected to this handlers and our databases and caches are abstracted using repositories etc.
How ever for the report features(I don't know that it is appropriate to call it a sub-domain or not), we don't know what to do and how to design the entities. Some of this reports are complicated and involve joining, validating etc on multiple datasets fetched for db, some other are very simple queries, squeezing them all inside a query handler doesn't seem appropriate and we don't know whether we need aggregates here or not. So we are quit stuck and confused.
...ANSWER
Answered 2021-Jul-04 at 14:19TL;DR: How would you do it if you weren't trying to apply DDD patterns? Do that.
Reports are, as a rule, read-only. They are just copies of information in a convenient shape.
What that means is that you don't need "clusters of associated objects that we treat as a unit for the purpose of data changes" (aggregates) because we aren't changing the data. You don't need repositories and factories because you aren't managing aggregate lifetimes. You don't need entities, because you don't need rules of information change.
"Value Objects" can sometimes be useful, but copying information into a value so that you can read it back out again is a waste of time.
(The exception to this would probably be something like a stand alone app, where your report is a description of the information currently stored within your in-memory aggregates.)
QUESTION
I am following this link for understanding hexagonal architecture with spring boot. The infrastructure section contains the configuration for the service bean and the repository is passed as a parameter as a below method.
Configuration
...ANSWER
Answered 2021-Jun-01 at 03:26You can refer to Spring Boot Configure and Use Two DataSources for creating multiple datasources and do something like following.
QUESTION
I have read Alistair's article on Hexagonal pattern and gone through other resources related to this (Alistair's videos, Short description of Ports & Adapters).
I understand the general idea of Hexagonal architecture and what are the advantages it brings to modern application development. But still, I have some confusion related to the actual implementation of Ports and Adapters.
Question 1:
From Alistair's article,
In an implementation, ports and adapters show up in two flavours, which I’ll call primary and secondary, for soon-to-be-obvious reasons. They could be also called driving adapters and driven adapters.
He Separates ports into two categories which are driving ports and driven ports. Driving ports control the application (GUI) and Driven port controlled by the application (database).
So if the driving port should only contain control APIs then how the Adapters at driving port side will get the event notifications. For example, in the below diagram I have two driving adapters which control the application but it also needs information from the application to send it back to other application connected to that adapter.
...ANSWER
Answered 2020-Sep-29 at 03:10Question 1:
A driver adapter starts the conversation with the hexagon, just that. But it doesnt have anything to do with the data flow, i.e., the driver port can return data to the driver adapter.
Question 2:
The drawing doesnt have any sense to me, could you please try to express it in another way?
==========================
If you wanna read more about hexagonal architecture:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install hexagonal-architecture
You can use hexagonal-architecture like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the hexagonal-architecture component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page