Use Autowired in TenantServiceImpl

This commit is contained in:
ViacheslavKlimov 2024-03-16 15:41:48 +02:00
parent a576a73b86
commit fc865252a8
8 changed files with 26 additions and 20 deletions

View File

@ -42,7 +42,6 @@ public class AssetProfileDataValidator extends DataValidator<AssetProfile> {
@Lazy
private AssetProfileService assetProfileService;
@Autowired
@Lazy
private TenantService tenantService;
@Lazy
@Autowired

View File

@ -16,7 +16,6 @@
package org.thingsboard.server.dao.service.validator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.thingsboard.server.common.data.Dashboard;
import org.thingsboard.server.common.data.EntityType;
@ -29,7 +28,6 @@ import org.thingsboard.server.dao.tenant.TenantService;
public class DashboardDataValidator extends DataValidator<Dashboard> {
@Autowired
@Lazy
private TenantService tenantService;
@Override

View File

@ -16,7 +16,6 @@
package org.thingsboard.server.dao.service.validator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.Device;
@ -40,7 +39,6 @@ public class DeviceDataValidator extends AbstractHasOtaPackageValidator<Device>
private DeviceDao deviceDao;
@Autowired
@Lazy
private TenantService tenantService;
@Autowired

View File

@ -86,7 +86,6 @@ public class DeviceProfileDataValidator extends AbstractHasOtaPackageValidator<D
@Autowired
private DeviceDao deviceDao;
@Autowired
@Lazy
private TenantService tenantService;
@Lazy
@Autowired

View File

@ -49,7 +49,6 @@ public class ResourceDataValidator extends DataValidator<TbResource> {
private WidgetTypeDao widgetTypeDao;
@Autowired
@Lazy
private TenantService tenantService;
@Autowired

View File

@ -53,7 +53,6 @@ public class RuleChainDataValidator extends DataValidator<RuleChain> {
private RuleChainService ruleChainService;
@Autowired
@Lazy
private TenantService tenantService;
@Override

View File

@ -18,6 +18,8 @@ package org.thingsboard.server.dao.tenant;
import com.google.common.util.concurrent.ListenableFuture;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.event.TransactionalEventListener;
@ -38,9 +40,9 @@ import org.thingsboard.server.dao.entity.AbstractCachedEntityService;
import org.thingsboard.server.dao.eventsourcing.DeleteEntityEvent;
import org.thingsboard.server.dao.eventsourcing.SaveEntityEvent;
import org.thingsboard.server.dao.notification.NotificationSettingsService;
import org.thingsboard.server.dao.service.DataValidator;
import org.thingsboard.server.dao.service.PaginatedRemover;
import org.thingsboard.server.dao.service.Validator;
import org.thingsboard.server.dao.service.validator.TenantDataValidator;
import org.thingsboard.server.dao.settings.AdminSettingsService;
import org.thingsboard.server.dao.usagerecord.ApiUsageStateService;
import org.thingsboard.server.dao.user.UserService;
@ -58,16 +60,28 @@ public class TenantServiceImpl extends AbstractCachedEntityService<TenantId, Ten
private static final String DEFAULT_TENANT_REGION = "Global";
public static final String INCORRECT_TENANT_ID = "Incorrect tenantId ";
private final TenantDao tenantDao;
private final TenantProfileService tenantProfileService;
private final UserService userService;
private final AssetProfileService assetProfileService;
private final DeviceProfileService deviceProfileService;
private final ApiUsageStateService apiUsageStateService;
private final AdminSettingsService adminSettingsService;
private final NotificationSettingsService notificationSettingsService;
private final DataValidator<Tenant> tenantValidator;
private final TbTransactionalCache<TenantId, Boolean> existsTenantCache;
@Autowired
private TenantDao tenantDao;
@Autowired
private TenantProfileService tenantProfileService;
@Autowired
@Lazy
private UserService userService;
@Autowired
private AssetProfileService assetProfileService;
@Autowired
private DeviceProfileService deviceProfileService;
@Lazy
@Autowired
private ApiUsageStateService apiUsageStateService;
@Autowired
private AdminSettingsService adminSettingsService;
@Autowired
private NotificationSettingsService notificationSettingsService;
@Autowired
private TenantDataValidator tenantValidator;
@Autowired
protected TbTransactionalCache<TenantId, Boolean> existsTenantCache;
@TransactionalEventListener(classes = TenantEvictEvent.class)
@Override

View File

@ -59,7 +59,7 @@ public class ApiUsageStateServiceImpl extends AbstractEntityService implements A
private final DataValidator<ApiUsageState> apiUsageStateValidator;
public ApiUsageStateServiceImpl(ApiUsageStateDao apiUsageStateDao, TenantProfileDao tenantProfileDao,
@Lazy TenantService tenantService, @Lazy TimeseriesService tsService,
TenantService tenantService, @Lazy TimeseriesService tsService,
DataValidator<ApiUsageState> apiUsageStateValidator) {
this.apiUsageStateDao = apiUsageStateDao;
this.tenantProfileDao = tenantProfileDao;