V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
PoetAndPoem
V2EX  ›  Java

注入 @inject 到父类

  •  
  •   PoetAndPoem · Jul 30, 2019 · 3329 views
    This topic created in 2468 days ago, the information mentioned may be changed or developed.

    注入一个 bean 到抽象类,不调用其任何方法,希望子类都能获得这个 bean 的初始化配置,可行吗,还是说必须在方法中调用 bean 才会在这个 scope 中生效?

    1 replies    2019-07-30 18:03:05 +08:00
    PoetAndPoem
        1
    PoetAndPoem  
    OP
       Jul 30, 2019
    解决了,为了防止容器里面没有这个 bean,最好还是调用一个空方法初始化这个 bean
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2491 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 08:41 · PVG 16:41 · LAX 01:41 · JFK 04:41
    ♥ Do have faith in what you're doing.