Java 如何在Spring引导应用程序中将int-Mongodb类型转换为boolean

Java 如何在Spring引导应用程序中将int-Mongodb类型转换为boolean,java,spring,mongodb,spring-data,Java,Spring,Mongodb,Spring Data,在日志中看到错误“ConverterNotFoundException:在浏览http://localhost:8080/inventory 我的课是这样的: class Item{ @Id private String id; ... @Field(value="is_on_sale") private boolean isOnSale //<--this } 我没有任何特殊的MongoDb配置,除了我的存储库,如: @RepositoryRestResource(

在日志中看到错误“
ConverterNotFoundException:在浏览
http://localhost:8080/inventory

我的课是这样的:

class Item{
@Id
private String id;
...
@Field(value="is_on_sale")
private boolean isOnSale //<--this
}
我没有任何特殊的MongoDb配置,除了我的存储库,如:

@RepositoryRestResource(collectionResourceRel = "inventory", path = "inventory")
public interface PurchaseRepository extends MongoRepository<Item, String> {
}
@RepositoryRestResource(collectionResourceRel=“inventory”,path=“inventory”)
公共接口PurchaseRepository扩展了MongoRepository{
}
这是一个简单的应用程序,只有以下依赖项:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>

org.springframework.boot
spring启动程序数据mongodb
org.springframework.boot
弹簧启动启动器数据rest

我已经读过很多书,我需要使用自定义转换器,但这意味着需要自定义mongodb配置,对吗?也就是说,我是否走上了正确的道路,或者解决这个问题是否比这更简单

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>