ClassPathXmlApplicationContext не может найти файл application1.xml в resources
Подскажите в чём может быть проблема? class path resource [application1.xml] cannot be opened because it does not exist
public class ApplicationRunner {
public static void main(String[] args) {
var context = new
ClassPathXmlApplicationContext("application1.xml");
System.out.println(context.getBean(ConnectionPool.class));
}
}
Структура проекта:
build.gradle:
plugins {
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
sourceSets{
main {
resources {
srcDir 'resources'
}
}
}
dependencies {
implementation 'org.springframework:spring-core:5.3.12'
implementation 'org.springframework:spring-context:5.3.12'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
test {
useJUnitPlatform()
}
wrapper{
gradleVersion '7.3'
}
Ошибка:
Caused by: java.io.FileNotFoundException: class path resource [application1.xml] cannot be opened because it does not exist