如果在使用spring中,发现注解不生效,检查下如下配置是否配置.

1:一般情况下@Autowired默认是不生效的,配置之后,才会生效

<context:annotation-config />

2:检查下是否配置了包的扫描,如果没有配置扫描,则也不会生效

 <context:component-scan base-package="com.demo.ass"/>

 

相关文章:

  • 2021-06-23
  • 2021-05-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-22
  • 2021-08-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
相关资源
相似解决方案