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.
1 Reply
JavaBot
JavaBot3w ago
This post has been reserved for your question.
Hey @Swam Yi! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?