Skip to content

Commit

Permalink
removing BoxSDKServiceConfigEntityService which is a circular dependency
Browse files Browse the repository at this point in the history
format fix
  • Loading branch information
hylstonnb authored and aurambaj committed Jul 31, 2023
1 parent 98b6029 commit 5f92dcd
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
package com.box.l10n.mojito.boxsdk;

import com.box.l10n.mojito.service.boxsdk.BoxSDKServiceConfigEntityService;
import org.springframework.beans.factory.annotation.Autowired;
import com.box.l10n.mojito.service.boxsdk.BoxSDKServiceConfigEntityRepository;
import org.springframework.stereotype.Component;

/** @author wyau */
@Component
public class BoxSDKServiceConfigProvider {

@Autowired BoxSDKServiceConfigFromProperties boxSDKServiceConfigFromProperties;
private final BoxSDKServiceConfigFromProperties boxSDKServiceConfigFromProperties;

@Autowired BoxSDKServiceConfigEntityService boxSDKServiceConfigEntityService;
private final BoxSDKServiceConfigEntityRepository boxSDKServiceConfigEntityRepository;

public BoxSDKServiceConfigProvider(
BoxSDKServiceConfigFromProperties boxSDKServiceConfigFromProperties,
BoxSDKServiceConfigEntityRepository boxSDKServiceConfigEntityRepository) {
this.boxSDKServiceConfigFromProperties = boxSDKServiceConfigFromProperties;
this.boxSDKServiceConfigEntityRepository = boxSDKServiceConfigEntityRepository;
}

/**
* @return The config to be used
Expand All @@ -22,7 +28,7 @@ public BoxSDKServiceConfig getConfig() throws BoxSDKServiceException {
if (boxSDKServiceConfigFromProperties.isUseConfigsFromProperties()) {
result = boxSDKServiceConfigFromProperties;
} else {
result = boxSDKServiceConfigEntityService.getBoxSDKServiceConfigEntity();
result = boxSDKServiceConfigEntityRepository.findFirstByOrderByIdAsc();

if (result == null) {
throw new BoxSDKServiceException(
Expand Down

0 comments on commit 5f92dcd

Please sign in to comment.