aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api/ObjectMapperProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/api/ObjectMapperProvider.java')
-rw-r--r--src/main/java/org/traccar/api/ObjectMapperProvider.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/api/ObjectMapperProvider.java b/src/main/java/org/traccar/api/ObjectMapperProvider.java
index cb7adab6c..4d8b266fa 100644
--- a/src/main/java/org/traccar/api/ObjectMapperProvider.java
+++ b/src/main/java/org/traccar/api/ObjectMapperProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2022 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,17 +16,20 @@
package org.traccar.api;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.traccar.Main;
import javax.ws.rs.ext.ContextResolver;
-import javax.ws.rs.ext.Provider;
-@Provider
public class ObjectMapperProvider implements ContextResolver<ObjectMapper> {
+ private final ObjectMapper objectMapper;
+
+ public ObjectMapperProvider(ObjectMapper objectMapper) {
+ this.objectMapper = objectMapper;
+ }
+
@Override
public ObjectMapper getContext(Class<?> type) {
- return Main.getInjector().getInstance(ObjectMapper.class);
+ return objectMapper;
}
}