Commit b0c6ce9f985279a65d2e8d22ed5f4f604f1df147
Committed by
Andrew Shvayka
1 parent
d44adcfe
Fix circular reference for CoapClientContext and CoapTransportContext
Showing
1 changed file
with
11 additions
and
1 deletions
@@ -22,6 +22,7 @@ import org.eclipse.californium.core.coap.Response; | @@ -22,6 +22,7 @@ import org.eclipse.californium.core.coap.Response; | ||
22 | import org.eclipse.californium.core.observe.ObserveRelation; | 22 | import org.eclipse.californium.core.observe.ObserveRelation; |
23 | import org.eclipse.californium.core.server.resources.CoapExchange; | 23 | import org.eclipse.californium.core.server.resources.CoapExchange; |
24 | import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; | 24 | import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; |
25 | +import org.springframework.context.annotation.Lazy; | ||
25 | import org.springframework.stereotype.Service; | 26 | import org.springframework.stereotype.Service; |
26 | import org.thingsboard.server.coapserver.CoapServerContext; | 27 | import org.thingsboard.server.coapserver.CoapServerContext; |
27 | import org.thingsboard.server.common.data.DataConstants; | 28 | import org.thingsboard.server.common.data.DataConstants; |
@@ -74,7 +75,6 @@ import static org.eclipse.californium.core.coap.Message.NONE; | @@ -74,7 +75,6 @@ import static org.eclipse.californium.core.coap.Message.NONE; | ||
74 | 75 | ||
75 | @Slf4j | 76 | @Slf4j |
76 | @Service | 77 | @Service |
77 | -@RequiredArgsConstructor | ||
78 | @ConditionalOnExpression("'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.coap.enabled}'=='true')") | 78 | @ConditionalOnExpression("'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.coap.enabled}'=='true')") |
79 | public class DefaultCoapClientContext implements CoapClientContext { | 79 | public class DefaultCoapClientContext implements CoapClientContext { |
80 | 80 | ||
@@ -86,6 +86,16 @@ public class DefaultCoapClientContext implements CoapClientContext { | @@ -86,6 +86,16 @@ public class DefaultCoapClientContext implements CoapClientContext { | ||
86 | private final ConcurrentMap<DeviceId, TbCoapClientState> clients = new ConcurrentHashMap<>(); | 86 | private final ConcurrentMap<DeviceId, TbCoapClientState> clients = new ConcurrentHashMap<>(); |
87 | private final ConcurrentMap<String, TbCoapClientState> clientsByToken = new ConcurrentHashMap<>(); | 87 | private final ConcurrentMap<String, TbCoapClientState> clientsByToken = new ConcurrentHashMap<>(); |
88 | 88 | ||
89 | + public DefaultCoapClientContext(CoapServerContext config, @Lazy CoapTransportContext transportContext, | ||
90 | + TransportService transportService, TransportDeviceProfileCache profileCache, | ||
91 | + PartitionService partitionService) { | ||
92 | + this.config = config; | ||
93 | + this.transportContext = transportContext; | ||
94 | + this.transportService = transportService; | ||
95 | + this.profileCache = profileCache; | ||
96 | + this.partitionService = partitionService; | ||
97 | + } | ||
98 | + | ||
89 | @Override | 99 | @Override |
90 | public boolean registerAttributeObservation(TbCoapClientState clientState, String token, CoapExchange exchange) { | 100 | public boolean registerAttributeObservation(TbCoapClientState clientState, String token, CoapExchange exchange) { |
91 | return registerFeatureObservation(clientState, token, exchange, FeatureType.ATTRIBUTES); | 101 | return registerFeatureObservation(clientState, token, exchange, FeatureType.ATTRIBUTES); |