我想在测试类中创建一个Lombok类
@RunWith(SpringRunner.class)
@SpringBootTest
public class HostelIntegrationTest {
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(NON_NULL)
@EqualsAndHashCode
class User {
String property1;
Instant property2;
Integer property3;
}
但是我得到这个编译错误:
modifier static not allowed here
最佳答案
@Builder
在内部创建static
内部类。
问题可能是非静态内部类中的静态内部类。
尝试使User
也成为static
//other annotations
@Builder
static class User {
String property1;
Instant property2;
Integer property3;
}
关于java - 无法在我的测试类: modifier static not allowed here中创建Lombok类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59785541/