Skip to content

Commit

Permalink
Merge pull request #10526 from ignasi35/restore-jackson-visibility-de…
Browse files Browse the repository at this point in the history
…faults

Restore Jackson visibility defaults
  • Loading branch information
ignasi35 committed Nov 9, 2020
2 parents 5de0ffc + 3c4efe2 commit ca0420f
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -5,9 +5,10 @@
package play.core

import scala.concurrent.Future

import akka.actor.ActorSystem
import akka.serialization.jackson.JacksonObjectMapperProvider
import com.fasterxml.jackson.annotation.JsonAutoDetect
import com.fasterxml.jackson.annotation.PropertyAccessor
import com.fasterxml.jackson.databind.ObjectMapper
import javax.inject._
import play.api.inject._
Expand Down Expand Up @@ -36,7 +37,9 @@ class ObjectMapperProvider @Inject() (lifecycle: ApplicationLifecycle, actorSyst
JacksonObjectMapperProvider
.get(actorSystem)
.getOrCreate(ObjectMapperProvider.BINDING_NAME, Option.empty)
mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.PUBLIC_ONLY)
Json.setObjectMapper(mapper)

lifecycle.addStopHook { () =>
Future.successful(Json.setObjectMapper(null))
}
Expand Down

0 comments on commit ca0420f

Please sign in to comment.