diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-16 16:20:13 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-16 16:20:13 -0700 |
commit | b100cb211161d1014dfaa1ab532f1670c699e80d (patch) | |
tree | 48b9191e793391f87e9fe5399d6ddf966040c184 /src/main/java/org/traccar/api/ObjectMapperProvider.java | |
parent | b47eca7a90438e738eb1486664717cccc277865f (diff) | |
download | trackermap-server-b100cb211161d1014dfaa1ab532f1670c699e80d.tar.gz trackermap-server-b100cb211161d1014dfaa1ab532f1670c699e80d.tar.bz2 trackermap-server-b100cb211161d1014dfaa1ab532f1670c699e80d.zip |
Improve web injection
Diffstat (limited to 'src/main/java/org/traccar/api/ObjectMapperProvider.java')
-rw-r--r-- | src/main/java/org/traccar/api/ObjectMapperProvider.java | 13 |
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; } } |