主要是这三个方面排查:
1,注入写成这样
@Autowired
private BrandServiceImpl brandServiceImpl;
2,jar冲突,在pom.xml中
<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.1</version> <configuration> <source>1.7</source> <target>1.7</target> <encoding>UTF-8</encoding> <compilerArguments> <bootclasspath>${java.home}/lib/rt.jar</bootclasspath> </compilerArguments> </configuration> </plugin> </plugins>
3,扫描包写的有问题
<context:component-scan ...>