错误java.lang.UnsupportedOperationException:没有访问者可以设置属性

时间:2020-03-14 10:29:01

标签: java spring-boot lombok

在部署到QA Env后运行代码时,我看到以下错误。同样的代码在我们的日食中运行良好。我在POM文件中添加了Lombok依赖性。我们是否需要像在Eclipse中一样将lombok安装到unix盒中?

java.lang.UnsupportedOperationException: No accessor to set property @org.springframework.data.cassandra.core.mapping.PrimaryKeyColumn(ordering=ASCENDING, forceQuote=false, name=order_number, type=PARTITIONED, value=order_number, ordinal=0)private final java.lang.String test.com.zdc.tmp.persistence.entity.OrderEntity.orderNumber!
    at test.com.zdc.tmp.persistence.entity.OrderEntity_Accessor_u9f29k.setProperty(Unknown Source) ~[periscope-persistence-0.0.1b191.jar!/:?]
    at org.springframework.data.mapping.model.ConvertingPropertyAccessor.setProperty(ConvertingPropertyAccessor.java:61) ~[spring-data-commons-2.1.10.RELEASE.jar!/:2.1.10.RELEASE]
    at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.readProperty(MappingCassandraConverter.java:313) ~[spring-data-cassandra-2.1.10.RELEASE.jar!/:2.1.10.RELEASE]
    at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.readProperties(MappingCassandraConverter.java:300) ~[spring-data-cassandra-2.1.10.RELEASE.jar!/:2.1.10.RELEASE]
    at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.doReadEntity(MappingCassandraConverter.java:289) ~[spring-data-cassandra-2.1.10.RELEASE.jar!/:2.1.10.RELEASE]
    at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.doReadEntity(MappingCassandraConverter.java:274) ~[spring-data-cassandra-2.1.10.RELEASE.jar!/:2.1.10.RELEASE]
    at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.readEntityFromRow(MappingCassandraConverter.java:252) ~[spring-data-cassandra-2.1.10.RELEASE.jar!/:2.1.10.RELEASE]
    at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.readRow(MappingCassandraConverter.java:248) ~[spring-data-cassandra-2.1.10.RELEASE.jar!/:2.1.10.RELEASE]

OrderEntity代码。

@Table("test")
@Value
@Builder
public class OrderEntity {

    @PrimaryKeyColumn(name = "order_number", ordinal = 0, type = PrimaryKeyType.PARTITIONED)
    String orderNumber;

1 个答案:

答案 0 :(得分:1)

@Value在Lombok中不会生成setter。参见here

使用@Data怎么办?