davidkiss / spring-cloud-streams-kafka-demo

Sample application using Spring Boot, Spring Cloud Stream and Kafka
42 stars 43 forks source link

The method builder() is undefined for the type Greetings #1

Open AnanthaRajuC opened 6 years ago

AnanthaRajuC commented 6 years ago

In the following class

package com.kaviddiss.streamkafka.web;

import com.kaviddiss.streamkafka.model.Greetings;
import com.kaviddiss.streamkafka.service.GreetingsService;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class GreetingsController {
    private final GreetingsService greetingsService;

    public GreetingsController(GreetingsService greetingsService) {
        this.greetingsService = greetingsService;
    }

    @GetMapping("/greetings")
    @ResponseStatus(HttpStatus.ACCEPTED)
    public void greetings(@RequestParam("message") String message) {
        Greetings greetings = Greetings.builder()
            .message(message)
            .timestamp(System.currentTimeMillis())
            .build();

        greetingsService.sendGreeting(greetings);
    }
}

I'm getting an error The method builder() is undefined for the type Greetings

davidkiss commented 6 years ago

Make sure you have the Lombok plugin installed in your IDE and if you're using Intellij, you'll also need to enable annotation processing

bizcontact commented 4 years ago

worked!