V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Newyorkcity
V2EX  ›  问与答

spring aop 不能切 @Controller 或者说要做特殊的配置?一切则被 @Autowired 的 @Service 类成员变量就注入不进来

  •  
  •   Newyorkcity · 2020-02-02 20:15:38 +08:00 · 580 次点击
    这是一个创建于 1715 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我把切点改到 @Service 的方法上,也一切正常,@Service 也要依靠 Spring 注入 @Repository 的 mapper 的呀,可是没任何问题。。
    然后一改回 @Controller 的方法上,需要 Spring 注入的 @Service 类的成员变量就 null 了,好生奇怪,咋回事儿啊?
    看样子像是 spring mvc 拒绝了切 @Controller 的编程,有什么考虑在其中么?

    谢谢
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   6028 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 06:17 · PVG 14:17 · LAX 23:17 · JFK 02:17
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.