刚开始一直报空指针异常,能创建对象但是对象为空,没办法调用方法
一直找不到原因,bean文件配置也正确
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 开启组件扫描-->
<context:component-scan base-package="com.yogurt.spring6.junit"></context:component-scan>
</beans>
后来终于发现,导错包了,Test导成Junit4的包,改成5就正确了哈哈哈哈哈(我也太笨了救命)