Skip to content
Advertisement

How to print to console in Spring Boot Web Application

Coming from a Node background, what is the equivalent of console.log() in spring boot?

For example I’d like to see in my console the job info in the following method.

@RequestMapping(value = "jobposts/create", method = RequestMethod.POST)
public Job create(@RequestBody Job job){
    System.out.println(job);
    return jobRepository.saveAndFlush(job);
}

System.out.println(); is how I know to do it in Java but it doesn’t seem to appear in my console. Using IntelliJ.

Advertisement

Answer

System.out.println(job); like you have done.

It prints something like yourpackage.Job@2g45e0f9

Try to execute you code using debug mode and see if the post method will be executed as it has to do.

Advertisement