How to Solve Error: Failed to load ApplicationContext

Solution: failed to load ApplicationContext

Generally, it can be solved according to the following steps
Step 1: check the annotation
check whether there are the following annotations

@RunWith(SpringRunner.class)
@SpringBootTest

If not, add dependencies and add comments

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.13</version>
    <scope>test</scope>
</dependency>

Step 2: check the package name
check whether the package name or package path in the XML file is correct, because beans are configured through XML. If they cannot be loaded, they are usually injected into the XML file in the container.

Example:

Step 3: check the encoding format
setting

application.yml

application.yml

Read More: