My application uses springboot with springdatajpa and is connected to two dbs(microsoft sql and mysql). For local developement and unit testing I am using same datasource classes for connecting to two inmemory h2 databases(one with mode mysql and other with mode ms sql). When the application starts “local” profile would be active by default and for unit tests “test” profile is used. Currently the datasource config classes are in src/main. But my senior wants it to be in src/test. I have two questions.
1)If datasource config is used for both local and test env then where should that class be placed?In src/main or src/test?
2)If I am trying to place it in src/test and trying to import it using @Import, i am getting circular dependency error. How can I make sure that data source beans get created when application is started.
Note:Gradle is my build tool.
RaM is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.