在Spring Boot 2.1.7 RELEASE中如何将xml文件作为资源导入库项目

时间:2019-09-23 09:11:45

标签: spring spring-boot

在我的项目层次结构中,有一个父项目和一个库项目。 图书馆项目具有这样的DataSourceConfiguration

import matplotlib.pyplot as plt
plt.figure(figsize=(10,7)) # 10 is width, 7 is height
plt.plot([1,2,3,4,5], [1,2,3,4,10], 'go', label='GreenDots')
plt.plot([1,2,3,4,5], [2,3,4,5,11], 'b*', label='Bluestars')
plt.title('A Simple Scatterplot')
plt.xlabel('X')
plt.ylabel('Y')
plt.xlim(0, 6)
plt.ylim(0, 12)
plt.legend(loc='best')
plt.show()

我的父类和更新的DataSourceConfiguration在下面给出

@Configuration
@ImportResource("classpath:conf/spring/datasource-config.xml")
public class DataSourceConfiguration
{
    @Autowired
    private ApplicationContext context = null;

    /**
     * Method to create DataAccessorDelegate bean
     * 
     * @return DataAccessorDelegate
     */
    @Bean(name = BeanNames.DATA_ACCESSOR_DELEGATE)
    @Scope("singleton")
    public DataAccessorDelegate getdataAccessorDelegate()
    {
        DataAccessorDelegate dataAccessorDelegate = new DataAccessorDelegate();
        return dataAccessorDelegate;
    }

DataSourceConfiguration

public class XERServiceMain {

    public static void main(String[] args) {

        ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder(XERServiceMain.class)
                .properties("spring.config.name:"classpath:conf/spring/datasource-config.xml","classpath*:**/module-context.xml")
                .build().run(args);
  }
}       

是否可以像这样将资源xml文件导入到库项目中?

0 个答案:

没有答案