Swam Yi
Swam Yi
JCHJava Community | Help. Code. Learn.
Created by Swam Yi on 1/4/2025 in #java-help
Common resources folder can't be accessed from different modules.
Hello! Has anyone taken the courses from Spring Academy? I need help with working with classpath across different modules. One of their tutorials include a common resources folder which is later accessed by different labs. For some reason, the code is not working in my pc.
@Configuration
@Import(RewardsConfig.class)
public class TestInfrastructureConfig {


@Bean
public DataSource dataSource() {
return (new EmbeddedDatabaseBuilder()) //
.addScript("classpath:rewards/testdb/schema.sql") //
.addScript("classpath:rewards/testdb/data.sql") //
.build();
}
}
@Configuration
@Import(RewardsConfig.class)
public class TestInfrastructureConfig {


@Bean
public DataSource dataSource() {
return (new EmbeddedDatabaseBuilder()) //
.addScript("classpath:rewards/testdb/schema.sql") //
.addScript("classpath:rewards/testdb/data.sql") //
.build();
}
}
The code is giving me FileNotFoundException. The sql files that I'm accessing is located in a common module called "00-rewards-common" module and my TestInfrastructureConfig class is inside "12-javaconfig-dependency-injection" module.
4 replies