1. If the project uses Spring annotations to complete dependency injection, you need to declare the annotation interpreter in the Spring basic configuration file and configure the annotation scanning package path
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" ... xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd ... <context:annotation-config/> <!-- Use this configuration to omit the previous configuration --> <context:component-scan base-package="com.meng"/> </beans>