-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade: spring boot to 3.x latest #149
Conversation
3082654
to
7b18b4d
Compare
@@ -4,7 +4,7 @@ | |||
* An entity, as explained in the DDD book. | |||
* | |||
*/ | |||
public interface Entity<T> { | |||
public interface DomainEntity<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this class renamed? Was it to avoid a namespace collision with JPA?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, IMHO, this class should not use a single word.
@@ -39,7 +40,8 @@ | |||
@RequestMapping("/admin") | |||
public final class CargoAdminController { | |||
|
|||
private final BookingServiceFacade bookingServiceFacade; | |||
@Autowired |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this dependency be injected into the constructor instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's hard and dangerous to do it since the injection currently has some circular.
It's the next step I'm planning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, got it. In that case, could you add a comment to this field explaining that it cannot be moved into the constructor params due to the circular dependency problem? Otherwise, my knee-jerk reaction seeing that autowired field would be to inline it 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got the reason by new investigation and make it inline with constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I know why some beans are defined in the context file (like DDDSampleApplicationContext) but some are defined by the annotation?
I think the domain layer should not have the runtime knowledge like CDI, but the infrastructure and interfaces may can do it.
I have some idea for optimizing the bean definitions to:
- no circular reference
- no duplicate bean definition
But I'm wondering about how to define the beans with the original principle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the code, I can't find any beans that are defined outside the context files. Can you give an example of a bean you found that is declared outside of a context file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see HandlingReportServiceImpl this class is defined outside the context files.
and TrackCommandValidator this class is defined inside the context file but CargoTrackingController is using it by new .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, CargoTrackingController should inject TrackCommandValidator instead of instantiating by new.
As for HandlingReportServiceImpl, using the @RestController annotation leads to significantly less configuration code, so I wouldn't want to refactor that to be instantiated programmatically in the context class.
186a4d7
to
f005c20
Compare
The bad news is that spring boot has released 3.4.0 |
@c5ms We (the core maintainers) have reviewed the change now and have a couple of proposals:
Once that is done, we feel the PR is ready for merge. |
@orende |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Why
Due to #141 , It's necessary to update the project with the latest spring boot version.
The DDD simple should have the modern technical stack to show how ddd gets implemented.
So, the project can be welcome to new committer with more ideas and best practices.
What