diff --git a/common/transport/coap/src/main/java/org/thingsboard/server/transport/coap/client/DefaultCoapClientContext.java b/common/transport/coap/src/main/java/org/thingsboard/server/transport/coap/client/DefaultCoapClientContext.java index 265980c0a9..4ea4a167aa 100644 --- a/common/transport/coap/src/main/java/org/thingsboard/server/transport/coap/client/DefaultCoapClientContext.java +++ b/common/transport/coap/src/main/java/org/thingsboard/server/transport/coap/client/DefaultCoapClientContext.java @@ -22,6 +22,7 @@ import org.eclipse.californium.core.coap.Response; import org.eclipse.californium.core.observe.ObserveRelation; import org.eclipse.californium.core.server.resources.CoapExchange; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.thingsboard.server.coapserver.CoapServerContext; import org.thingsboard.server.common.data.DataConstants; @@ -74,7 +75,6 @@ import static org.eclipse.californium.core.coap.Message.NONE; @Slf4j @Service -@RequiredArgsConstructor @ConditionalOnExpression("'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.coap.enabled}'=='true')") public class DefaultCoapClientContext implements CoapClientContext { @@ -86,6 +86,16 @@ public class DefaultCoapClientContext implements CoapClientContext { private final ConcurrentMap clients = new ConcurrentHashMap<>(); private final ConcurrentMap clientsByToken = new ConcurrentHashMap<>(); + public DefaultCoapClientContext(CoapServerContext config, @Lazy CoapTransportContext transportContext, + TransportService transportService, TransportDeviceProfileCache profileCache, + PartitionService partitionService) { + this.config = config; + this.transportContext = transportContext; + this.transportService = transportService; + this.profileCache = profileCache; + this.partitionService = partitionService; + } + @Override public boolean registerAttributeObservation(TbCoapClientState clientState, String token, CoapExchange exchange) { return registerFeatureObservation(clientState, token, exchange, FeatureType.ATTRIBUTES);