Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 从SpringXML读取_Java_Spring_Spring Boot - Fatal编程技术网

Java 从SpringXML读取

Java 从SpringXML读取,java,spring,spring-boot,Java,Spring,Spring Boot,当XML存在于jar中时,它将正常工作并读取XML。我希望将XML从jar中删除到机器上的现有文件夹中。 执行此操作时,不会读取XML。如何从机器文件系统而不是从jar读取XML 提前谢谢 试试这个: import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.

当XML存在于jar中时,它将正常工作并读取XML。我希望将XML从jar中删除到机器上的现有文件夹中。 执行此操作时,不会读取XML。如何从机器文件系统而不是从jar读取XML

提前谢谢

试试这个:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.context.annotation.ImportResource;

@SpringBootApplication
@EnableAutoConfiguration(exclude={file1.class, file2.class})
@ImportResource(locations = {"classpath*:applicationContext.xml"})
public class Trans{

    public static void main(String[] args) {
        SpringApplication.run(Trans.class, args);
    }

}

可能是重复的?我不确定我是否明白。您的
applicationContext.xml
在哪里?
@ImportResource(locations = {"file:/some/resource/path/applicationContext.xml"})