解决:Failed to load ApplicationContext

解决:Failed to load ApplicationContext

Generally follow the steps below to solve

Step 1: Check the annotations

Check if 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 the bean is configured through xml. For those that cannot be loaded, usually start with the xml file that is injected into the container.

Example:

Insert picture description here

Step 3: Check the encoding format

setting

Insert picture description here

application.yml

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44829930/article/details/109323453