Newyorkcity
V2EX  ›  问与答

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

  •  
  •   Newyorkcity · Feb 2, 2020 · 841 views
    This topic created in 2299 days ago, the information mentioned may be changed or developed.
    我把切点改到 @Service 的方法上,也一切正常,@Service 也要依靠 Spring 注入 @Repository 的 mapper 的呀,可是没任何问题。。
    然后一改回 @Controller 的方法上,需要 Spring 注入的 @Service 类的成员变量就 null 了,好生奇怪,咋回事儿啊?
    看样子像是 spring mvc 拒绝了切 @Controller 的编程,有什么考虑在其中么?

    谢谢
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5141 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 05:45 · PVG 13:45 · LAX 22:45 · JFK 01:45
    ♥ Do have faith in what you're doing.