How to set a specific DataSource for a Repository?

前端 未结 4 1156
半阙折子戏
半阙折子戏 2021-01-04 18:43

Is it possible to assign a specific DataSource to a @Repository?

I\'d like to create a test environment where in general I want to use the

4条回答
  •  独厮守ぢ
    2021-01-04 19:18

    The DataSource and JpaRepository are both tied to an EntityManager. You will have to segregate the repositories into separate packages for your requirement to work.

    Here is an example:

    
      
        
      
      ...
    
    
    
    
      
        
      
      ...
    
    
    

提交回复
热议问题