rzo1 opened a new pull request, #2959: URL: https://github.com/apache/tomee/pull/2959
https://issues.apache.org/jira/browse/TOMEE-4715 ## Problem `@Resource` fields of the `@Application` descriptor and of the test instances are not injected if the application is started via `TomEEEmbeddedApplicationRunner` (`@RunWithTomEEEmbedded`, `TomEEEmbeddedSingleRunner`). They are not components of the deployed application, so there are no resource references for them. With the ApplicationComposer the same descriptor gets its `DataSource`. This gets relevant with TOMEE-4707, as tests using `@EnableServices("jaxrs")` need to move to TomEE embedded. ## Change `composerInject` links container resources (`openejb/Resource/<id>`) for `@Resource` fields which are still `null` after the CDI injection: - `lookup`: JNDI lookup, then the container resource with that id. - `name`: the container resource with that name. - neither: the resource matching the name of the field, then the first resource matching the type (like the auto linking of `AutoConfig`). An explicit `lookup` or `name` which can't be resolved is logged as warning and the field stays `null`, no other resource is injected instead. ## Limitations - Fields only, no setter injection. - Container resources only. Other `@Resource` types (e.g. `UserTransaction`) are still not injected. ## Tests Two new surefire executions in `tomee-embedded`: `single-server-resource-injection` (name, lookup, unresolvable ones) and `single-server-resource-by-type-injection`. Both inject into the descriptor and the test instance and open a connection. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
