javaspringspring-boot

Java Spring Boot problem LoggiFailureAnalysisReporter


I am new to Boot-Spring apparently, I mostly copy some code from youtube on this case. However, after modification, in the end, I got a message like this; APPLICATION FAILED TO START



Solution

  • Your BlogApplication Class, which is the class annotated with @SpringBootApplication is in the package com.example.demo. That means that, by default, Spring is going to launch a Component Scan starting from that package.

    The problem is that your class PostService and your interface PostRepository are not in the same package as (or in a sub-package of) com.example.demo, so Spring can't find them and won't automatically create these beans for you.

    To correct this issue, move the packages you created inside your root package (com.example.demo).

    You can find more information about the use of @SpringBootApplication here.