springboot使用xml

虽然springboot不提倡用xml,但是我们有可能也是会用到的

代码示例

1.创建一个配置文件在resources下,如下图所示

2.设置配置类

@Configuration
@ImportResource("classpath:elasticjob/*.xml")
public class JobConfig {
}

注意问题

我这里新建了一个文件夹,如果你直接在新建一个xml文件,
直接这样写@ImportResource("xx.xml")

好了,玩的开心

相关文章:

  • 2021-12-08
  • 2021-07-27
  • 2021-11-06
  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
相关资源
相似解决方案