How to set a specific DataSource for a Repository?

前端 未结 4 1167
半阙折子戏
半阙折子戏 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:24

    Just set the name attribute of the @PersistenceContext annotation when declaring your EntityManager.

    @PersistenceContext(name="persistence-unit-name")
    private EntityManager em;
    

提交回复
热议问题