I have a problem. Lets ı explain my project structure and problems.
1. Multi Module Project you will see project structure below.
Github: https://github.com/CihanGurkan01/auth-service
2. Data Core Project Normal spring boot project. I thought use multi dataSource with SpringJpa repository.
Github: https://github.com/CihanGurkan01/data-core-project
Problem: I have a properties file it name is data-core-application.yaml in data-core-project. I thought use this properties file in CommonDataSourceProperties.class of data-core-project but ı tryed start multi module project. It is crash because it doesn't see data-core-application.yaml
How Can I See data-core-application.yaml file for multi-project?
When AuthService is starting but it has problem. Because İt doest see properties file of another project resources.
The thing I don't see in your project - is how do you import your beans from library to auth-service.
Official Spring documentation suggests two different ways of importing a library into your application. One of them is using auto-configuration and the other one is using custom annotations.
I added link of guide how to use auto-configurations.
Here is example how to use Custom Annotations
1) Create annotation + add import configuration classes
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Import(CustomDatasourceConfiguration.class)
public @interface EnableCustomDataSources {
}
2) Deploy and add library to POM
3) Import Annotation to base project
@SpringBootApplication
@EnableFeignClients
@EnableCustomDataSources
public class AuthApplication {
public static void main(String[] args) {
SpringApplication.run(AuthApplication.class, args);
}
}
3rd variant - the most crunchy I don't recommend using it, I recommend making separate annotation for this at least. But u can test it just to make sure it works.
Add this into your auth-service-app