你好,我正在尝试使用Spring Boot + Spring Data JPA + Spring Data REST开发REST API。
我希望只暴露我的用户实体的可写部分(基本上不包括GET或GET ALL),如下所示:
@Entity(name = "User")
public class User implements Serializable {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
int id;
@Column
String login;
@Column
String password;
@Column
String username;
@Column
String address1;
@Column
String address2;
@Column
String city;
@Column
String state;
@Column
String zip;
@Column
String country;
@Column
String creditcard;
}
数据仓库如下:
@RepositoryRestResource(path = "users")
public interface UserRepository extends CrudRepository<User, String> {
}
我该如何实现这个?