Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3667

Cannot find symbol with Lombok

$
0
0

Basically I'm trying to create an API using Spring Boot, however I have some problems with Lombok annotations.

This is my domain (I can use @Data, but it shows the same error):

@Entity@Table(name = "users")@Getter@Setter@NoArgsConstructor@AllArgsConstructorpublic 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;}

This is my service:

@Servicepublic 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;    }}

In my pom.xml I have the following related with lombok:

<dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional></dependency><configuration><annotationProcessorPaths><path><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></path></annotationProcessorPaths></configuration><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><excludes><exclude><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></exclude></excludes></configuration></plugin>

And the error that I'm getting is related with the boilerplate code I think.

java: cannot find symbolsymbol:   method setName(java.lang.String)location: variable user of type com.example.restproject.domain.user.User

I have the annotation processing in the settings enabled.


Viewing all articles
Browse latest Browse all 3667

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>