Java 从SpringXML读取
当XML存在于jar中时,它将正常工作并读取XML。我希望将XML从jar中删除到机器上的现有文件夹中。 执行此操作时,不会读取XML。如何从机器文件系统而不是从jar读取XML 提前谢谢 试试这个: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.
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"})