zoukankan      html  css  js  c++  java
  • SpringBoot -> @Import引入配置类 @ImportResource引入xml配置文件

    在启动类上加 @Import(UserConfig.class) 注解引入其他需要的配置类(@Configuration注解过的类)

    @ImportResource引入xml配置文件,代码如下:

    package com.jiaobuchong.config;
    
    import org.springframework.context.annotation.Configuration;
    import org.springframework.context.annotation.Import;
    import org.springframework.context.annotation.ImportResource;
    
    @Configuration
    @Import(CDPlayerConfig.class)  
    @ImportResource("classpath:cons-injec.xml") //导入xml配置项
    public class SoundSystemConfig {
    
    }

    参考资料:

    1、SpringBoot -> @Import使用

    2、springboot @import @importResource 注解使用方式 

     
  • 相关阅读:
    12
    11
    10
    9
    8
    7
    6
    5
    4
    3
  • 原文地址:https://www.cnblogs.com/dancser/p/12675633.html
Copyright © 2011-2022 走看看