Skip to content

Commit bfbdc7c

Browse files
committed
Bugfix: Spring Boot discovery strategy wrongly created a cyclic reference to own object for each discovered reference
1 parent 0abfd01 commit bfbdc7c

File tree

2 files changed

+26
-31
lines changed

2 files changed

+26
-31
lines changed

Examples/LakesideMutual/src-gen/lakesidemutual.cml

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ BoundedContext PolicyManagement {
3838
}
3939
Entity insurance_quote_requests_RootEntity {
4040
aggregateRoot
41-
def List<@InsuranceQuoteRequestDto> getInsuranceQuoteRequests;
42-
def @InsuranceQuoteRequestDto getInsuranceQuoteRequest;
41+
* List<@InsuranceQuoteRequestDto> getInsuranceQuoteRequests;
42+
* @InsuranceQuoteRequestDto getInsuranceQuoteRequest;
4343
}
4444
}
4545
// This Aggregate has been created on the basis of the RESTful HTTP controller com.lakesidemutual.policymanagement.interfaces.CustomerInformationHolder.
@@ -50,16 +50,15 @@ BoundedContext PolicyManagement {
5050
}
5151
Entity customers_RootEntity {
5252
aggregateRoot
53-
def @CustomerDto getCustomer (@CustomerIdDto customerIdDto);
54-
def List<@customers_PolicyDto> getPolicies (@CustomerIdDto customerIdDto);
55-
def @PaginatedCustomerResponseDto getCustomers;
53+
* @CustomerDto getCustomer (@CustomerIdDto customerIdDto);
54+
* List<@customers_PolicyDto> getPolicies (@CustomerIdDto customerIdDto);
55+
* @PaginatedCustomerResponseDto getCustomers;
5656
}
5757
// This value object has been derived from the class com.lakesidemutual.policymanagement.interfaces.dtos.customer.CustomerDto.
5858
ValueObject CustomerDto {
5959
String customerId
6060
CustomerProfileDto customerProfile
6161
List<Link> links
62-
- List<CustomerDto> customers
6362
}
6463
// This value object has been derived from the class com.lakesidemutual.policymanagement.interfaces.dtos.policy.PolicyDto.
6564
ValueObject customers_PolicyDto {
@@ -106,7 +105,6 @@ BoundedContext PolicyManagement {
106105
InsuringAgreementDto insuringAgreement
107106
Date creationDate
108107
Object customer
109-
- List<PolicyDto> policies
110108
}
111109
// This value object has been derived from the class com.lakesidemutual.policymanagement.interfaces.dtos.policy.CreatePolicyRequestDto.
112110
ValueObject CreatePolicyRequestDto {
@@ -120,9 +118,9 @@ BoundedContext PolicyManagement {
120118
}
121119
Entity policies_RootEntity {
122120
aggregateRoot
123-
def @PolicyDto getPolicy (@PolicyId policyId);
124-
def @PolicyDto updatePolicy (@CreatePolicyRequestDto createPolicyDto, @PolicyId policyId);
125-
def @PaginatedPolicyResponseDto getPolicies;
121+
* @PolicyDto getPolicy (@PolicyId policyId);
122+
* @PolicyDto updatePolicy (@CreatePolicyRequestDto createPolicyDto, @PolicyId policyId);
123+
* @PaginatedPolicyResponseDto getPolicies;
126124
}
127125
// This value object has been derived from the class com.lakesidemutual.policymanagement.interfaces.dtos.policy.PaginatedPolicyResponseDto.
128126
ValueObject PaginatedPolicyResponseDto {
@@ -157,7 +155,7 @@ BoundedContext CustomerManagement {
157155
ValueObject CustomerManagement_customers_CustomerDto {
158156
List<Link> links
159157
String customerId
160-
- CustomerProfileDto customerProfile - List<CustomerManagement_customers_CustomerDto> customers
158+
- CustomerProfileDto customerProfile
161159
}
162160
// This value object has been derived from the class com.lakesidemutual.customermanagement.interfaces.dtos.CustomerProfileDto.
163161
ValueObject CustomerProfileDto {
@@ -168,13 +166,12 @@ BoundedContext CustomerManagement {
168166
String lastname
169167
String ^email
170168
AddressDto currentAddress
171-
- CustomerProfileDto customerProfile
172169
}
173170
Entity CustomerManagement_customers_RootEntity {
174171
aggregateRoot
175-
def @CustomerManagement_customers_PaginatedCustomerResponseDto getCustomers;
176-
def @CustomerManagement_customers_CustomerDto getCustomer (@CustomerManagement_customers_CustomerId customerId);
177-
def @CustomerManagement_customers_CustomerDto updateCustomer (@CustomerManagement_customers_CustomerId customerId, @CustomerProfileDto customerProfile);
172+
* @CustomerManagement_customers_PaginatedCustomerResponseDto getCustomers;
173+
* @CustomerManagement_customers_CustomerDto getCustomer (@CustomerManagement_customers_CustomerId customerId);
174+
* @CustomerManagement_customers_CustomerDto updateCustomer (@CustomerManagement_customers_CustomerId customerId, @CustomerProfileDto customerProfile);
178175
}
179176
// This value object has been derived from the class com.lakesidemutual.customermanagement.domain.customer.CustomerId.
180177
ValueObject CustomerManagement_customers_CustomerId {
@@ -186,7 +183,7 @@ BoundedContext CustomerManagement {
186183
Aggregate notifications {
187184
Entity notifications_RootEntity {
188185
aggregateRoot
189-
def List<@NotificationDto> getNotifications;
186+
* List<@NotificationDto> getNotifications;
190187
}
191188
// This value object has been derived from the class com.lakesidemutual.customermanagement.interfaces.dtos.NotificationDto.
192189
ValueObject NotificationDto {
@@ -211,7 +208,7 @@ BoundedContext CustomerManagement {
211208
}
212209
Entity interaction_logs_RootEntity {
213210
aggregateRoot
214-
def @InteractionLogAggregateRoot getInteractionLog (@interaction_logs_CustomerId customerId);
211+
* @InteractionLogAggregateRoot getInteractionLog (@interaction_logs_CustomerId customerId);
215212
}
216213
}
217214
}
@@ -238,8 +235,8 @@ BoundedContext CustomerSelfService {
238235
}
239236
Entity CustomerSelfService_insurance_quote_requests_RootEntity {
240237
aggregateRoot
241-
def @CustomerSelfService_insurance_quote_requests_InsuranceQuoteRequestDto getInsuranceQuoteRequest;
242-
def List<@CustomerSelfService_insurance_quote_requests_InsuranceQuoteRequestDto> getInsuranceQuoteRequests;
238+
* @CustomerSelfService_insurance_quote_requests_InsuranceQuoteRequestDto getInsuranceQuoteRequest;
239+
* List<@CustomerSelfService_insurance_quote_requests_InsuranceQuoteRequestDto> getInsuranceQuoteRequests;
243240
}
244241
}
245242
// This Aggregate has been created on the basis of the RESTful HTTP controller com.lakesidemutual.customerselfservice.interfaces.CityStaticDataHolder.
@@ -250,14 +247,14 @@ BoundedContext CustomerSelfService {
250247
}
251248
Entity CustomerSelfService_cities_RootEntity {
252249
aggregateRoot
253-
def @CustomerSelfService_cities_CitiesResponseDto getCitiesForPostalCode;
250+
* @CustomerSelfService_cities_CitiesResponseDto getCitiesForPostalCode;
254251
}
255252
}
256253
// This Aggregate has been created on the basis of the RESTful HTTP controller com.lakesidemutual.customerselfservice.interfaces.UserInformationHolder.
257254
Aggregate user {
258255
Entity user_RootEntity {
259256
aggregateRoot
260-
def @UserResponseDto getCurrentUser;
257+
* @UserResponseDto getCurrentUser;
261258
}
262259
// This value object has been derived from the class com.lakesidemutual.customerselfservice.interfaces.dtos.identityaccess.UserResponseDto.
263260
ValueObject UserResponseDto {
@@ -290,9 +287,9 @@ BoundedContext CustomerSelfService {
290287
}
291288
Entity CustomerSelfService_customers_RootEntity {
292289
aggregateRoot
293-
def @CustomerSelfService_customers_AddressDto changeAddress (@CustomerSelfService_customers_CustomerId customerId, @CustomerSelfService_customers_AddressDto requestDto);
294-
def @CustomerSelfService_customers_CustomerDto getCustomer (@CustomerSelfService_customers_CustomerId customerId);
295-
def List<@CustomerSelfService_customers_InsuranceQuoteRequestDto> getInsuranceQuoteRequests (@CustomerSelfService_customers_CustomerId customerId);
290+
* @CustomerSelfService_customers_AddressDto changeAddress (@CustomerSelfService_customers_CustomerId customerId, @CustomerSelfService_customers_AddressDto requestDto);
291+
* @CustomerSelfService_customers_CustomerDto getCustomer (@CustomerSelfService_customers_CustomerId customerId);
292+
* List<@CustomerSelfService_customers_InsuranceQuoteRequestDto> getInsuranceQuoteRequests (@CustomerSelfService_customers_CustomerId customerId);
296293
}
297294
// This value object has been derived from the class com.lakesidemutual.customerselfservice.interfaces.dtos.customer.AddressDto.
298295
ValueObject CustomerSelfService_customers_AddressDto {
@@ -309,7 +306,7 @@ BoundedContext CustomerCore {
309306
Aggregate cities {
310307
Entity cities_RootEntity {
311308
aggregateRoot
312-
def @CitiesResponseDto getCitiesForPostalCode;
309+
* @CitiesResponseDto getCitiesForPostalCode;
313310
}
314311
// This value object has been derived from the class com.lakesidemutual.customercore.interfaces.dtos.city.CitiesResponseDto.
315312
ValueObject CitiesResponseDto {
@@ -331,10 +328,10 @@ BoundedContext CustomerCore {
331328
}
332329
Entity CustomerCore_customers_RootEntity {
333330
aggregateRoot
334-
def @CustomerResponseDto updateCustomer (@CustomerId customerId, @CustomerProfileUpdateRequestDto requestDto);
335-
def @CustomersResponseDto getCustomer;
336-
def @AddressDto changeAddress (@AddressDto requestDto, @CustomerId customerId);
337-
def @CustomerCore_customers_PaginatedCustomerResponseDto getCustomers;
331+
* @CustomerResponseDto updateCustomer (@CustomerProfileUpdateRequestDto requestDto, @CustomerId customerId);
332+
* @CustomersResponseDto getCustomer;
333+
* @AddressDto changeAddress (@CustomerId customerId, @AddressDto requestDto);
334+
* @CustomerCore_customers_PaginatedCustomerResponseDto getCustomers;
338335
}
339336
// This value object has been derived from the class com.lakesidemutual.customercore.interfaces.dtos.customer.CustomerProfileUpdateRequestDto.
340337
ValueObject CustomerProfileUpdateRequestDto {
@@ -360,7 +357,6 @@ BoundedContext CustomerCore {
360357
Date birthday
361358
String customerId
362359
List<Link> links
363-
- List<CustomerResponseDto> customers - List<CustomerResponseDto> customers
364360
}
365361
// This value object has been derived from the class com.lakesidemutual.customercore.interfaces.dtos.customer.CustomersResponseDto.
366362
ValueObject CustomersResponseDto {

src/main/java/org/contextmapper/discovery/strategies/boundedcontexts/AbstractRESTResourceBasedBoundedContextDiscoveryStrategy.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ private DomainObject searchDomainObjectInAllAggregates(Class<?> type) {
254254
private Reference createReference(String name, DomainObject domainObject, String collectionType) {
255255
Reference reference = new Reference(domainObject, name);
256256
reference.setCollectionType(collectionType);
257-
domainObject.addReference(reference);
258257
return reference;
259258
}
260259

0 commit comments

Comments
 (0)