1

Is there a simple way to expose a resource as JNDI resource so that it satisfies the JTA data source reference in persistence.xml (already there, have to reuse it for some reasons)?

If not in Spring Boot, can we do it using Java EE, like using an @Resource annotation?

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Paddy
  • 3,472
  • 5
  • 29
  • 48

1 Answers1

0

You could setup your own JNDI context using the Apache classes used by Tomcat to create an InitialContext, something like this: https://blogs.oracle.com/randystuph/entry/injecting_jndi_datasources_for_junit

You could set that up in a @Configuration class where you create your DataSource.

MattR
  • 6,908
  • 2
  • 21
  • 30