网站介绍:文章浏览阅读2.6k次,点赞4次,收藏3次。在学习Spring 注解注入出现此问题主要原因:这个注解不能写在局部变量,也就是不能写在方法体里,写外面去就好了package com.bgu.edu;import org.junit.Test;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.context.ApplicationContext;import org.springframework.context._@autowired' not applicable to local variable
- 链接地址:https://blog.csdn.net/weixin_43958308/article/details/109063652
- 链接标题:‘@Autowired‘ not applicable to local variable_@autowired' not applicable to local variable-CSDN博客
- 所属网站:blog.csdn.net
- 被收藏次数:4059
- 网站标签:@autowired' not applicable to local variable