Spring -Mongodb storing/retrieving enums as int not string

后端 未结 2 648
刺人心
刺人心 2020-12-17 21:08

My enums are stored as int in mongodb (from C# app). Now in Java, when I try to retrieve them, it throws an exception (it seems enum can be converted from string value only)

2条回答
  •  抹茶落季
    2020-12-17 21:32

    You will need to implement your custom converters and register it with spring.

    http://static.springsource.org/spring-data/data-mongo/docs/current/reference/html/#mongo.custom-converters

提交回复
热议问题