Это мой домен (я могу использовать @Data , но показывает ту же ошибку):
Код: Выделить всё
@Entity
@Table(name = "users")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class User {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
public UUID id;
@NotEmpty
@Column(nullable = false)
public String name;
@NotEmpty
@Email
@Column(unique = true, nullable = false)
public String email;
@NotEmpty
@Size(min = 8)
@Column(nullable = false)
public String password;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
public UserRoles role;
@Column(name = "created_at")
private Timestamp createdAt;
}
Код: Выделить всё
@Service
public class UserService {
private final UserRepository userRepository;
public UserService(UserRepository userRepository) {
this.userRepository = userRepository;
}
public User createUser(UserDto dto) {
User user = new User();
user.setName(dto.name());
user.setEmail(dto.email());
user.setPassword(dto.password());
this.userRepository.save(user);
return user;
}
}
Код: Выделить всё
org.projectlombok
lombok
true
org.projectlombok
lombok
org.springframework.boot
spring-boot-maven-plugin
org.projectlombok
lombok
Код: Выделить всё
java: cannot find symbol
symbol: method setName(java.lang.String)
location: variable user of type com.example.restproject.domain.user.User
Подробнее здесь: https://stackoverflow.com/questions/792 ... ith-lombok
Мобильная версия