uCharles
V2EX  ›  问与答

Quartz 的 job 中 @Value 得到的值是 null

  •  
  •   uCharles · Sep 27, 2022 · 813 views
    This topic created in 1333 days ago, the information mentioned may be changed or developed.
    /**
     * 自定义 job
     */
    @Component
    @Slf4j
    public class LpaSendProjectMessageJob extends QuartzJobBean {
    
        @Value("${system.agentId}")
        private String agentId;
    }
    

    agentId 是 null ,service 无法注入的问题搞定了,但是 @Value 咋弄呢?

    uCharles
        1
    uCharles  
    OP
       Sep 27, 2022
    放弃了,改用 Environment 来获取参数了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1156 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 18:12 · PVG 02:12 · LAX 11:12 · JFK 14:12
    ♥ Do have faith in what you're doing.