Open 419572718 opened 2 years ago
Please answer some questions before submitting your issue. Thanks!
2.0.1
@RefreshScope @Bean( initMethod = "start", destroyMethod = "destroy" ) public XxlJobSpringExecutor xxlJobExecutor() { logger.info( ">>>>>>>>>>> xxl-job config init." ); XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); xxlJobSpringExecutor.setAdminAddresses( adminAddresses ); // todo 版本冲突 xxlJobSpringExecutor.setAppName( appName ); xxlJobSpringExecutor.setIp( ip ); xxlJobSpringExecutor.setPort( port ); xxlJobSpringExecutor.setAccessToken( accessToken ); xxlJobSpringExecutor.setLogPath( logPath ); xxlJobSpringExecutor.setLogRetentionDays( logRetentionDays ); return xxlJobSpringExecutor; } 通过@RefreshScope注解实现配置中心的动态更新配置
xxljob服务没有启动
@RefreshScope @Configuration public class XxlJobConfig { private Logger logger = LoggerFactory.getLogger( XxlJobConfig.class );
@Value( "${xxl.job.admin.addresses}" ) private String adminAddresses; @Value( "${xxl.job.executor.appname}" ) private String appName; @Value( "${xxl.job.executor.ip}" ) private String ip; @Value( "${xxl.job.executor.port}" ) private int port; @Value( "${xxl.job.accessToken}" ) private String accessToken; @Value( "${xxl.job.executor.logpath}" ) private String logPath; @Value( "${xxl.job.executor.logretentiondays}" ) private int logRetentionDays; @RefreshScope @Bean( initMethod = "start", destroyMethod = "destroy" ) public XxlJobSpringExecutor xxlJobExecutor() { logger.info( ">>>>>>>>>>> xxl-job config init." ); XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); xxlJobSpringExecutor.setAdminAddresses( adminAddresses ); // todo 版本冲突 xxlJobSpringExecutor.setAppName( appName ); xxlJobSpringExecutor.setIp( ip ); xxlJobSpringExecutor.setPort( port ); xxlJobSpringExecutor.setAccessToken( accessToken ); xxlJobSpringExecutor.setLogPath( logPath ); xxlJobSpringExecutor.setLogRetentionDays( logRetentionDays ); return xxlJobSpringExecutor; }
}
我们也用的这个版本,这个问题也出现了。后面采取的是配置写到一个配置类里,这个Config 类提供get方法给 Executor 类使用。
我测试了一下 在最新的2.4.0版本依然没有修复
能具体说说吗
Please answer some questions before submitting your issue. Thanks!
Which version of XXL-JOB do you using?
2.0.1
Expected behavior
Actual behavior
Steps to reproduce the behavior
@RefreshScope @Configuration public class XxlJobConfig { private Logger logger = LoggerFactory.getLogger( XxlJobConfig.class );
}
Other information