JEE Core Concepts - Resources, Naming and Injection: Difference between revisions
Line 11: | Line 11: | ||
The application code relies on [[#Environment_Entry|ENC named entries]] to refer to configuration values and external resources. | The application code relies on [[#Environment_Entry|ENC named entries]] to refer to configuration values and external resources. | ||
The names of those elements do not change in the code, and those names are mapped to deployment environment specific values and resources during deployment. The | The names of those elements do not change in the code, and those names are mapped to deployment environment specific values and resources during deployment. The most portable way of mapping the environment specific values and resources is to specify them in deployment descriptors. The deployment descriptors act as a layer of indirection between code and the deployment environment. The code does not change, but the deployment descriptors do. The developers have an option to also do that mapping in the code, using "lookup" attributes associated with various annotations, but that results in code less portable between environments. | ||
=Application Component Environment= | =Application Component Environment= |
Revision as of 18:39, 7 April 2017
Internal
Changing Application Behavior without Changing Code
The possibility to change an application's behavior without changing code is a core concern in JEE. The entire Chapter 5 in the JEE specifications is dedicated to it.
The mechanism than makes this possible is the application component environment, also known as "enterprise naming context" or "ENC".
The application code relies on ENC named entries to refer to configuration values and external resources.
The names of those elements do not change in the code, and those names are mapped to deployment environment specific values and resources during deployment. The most portable way of mapping the environment specific values and resources is to specify them in deployment descriptors. The deployment descriptors act as a layer of indirection between code and the deployment environment. The code does not change, but the deployment descriptors do. The developers have an option to also do that mapping in the code, using "lookup" attributes associated with various annotations, but that results in code less portable between environments.
Application Component Environment
The application component environment is also known as enterprise naming context or ENC.
Environment Entry
Simple Environment Entry
TODO
- Review WildFly JNDI Concepts.
- Review @javax.annotation.Resource
- Review EJB_Annotations#.40javax.ejb.EJB
- Try to bind entries in jboss-app.xml, jboss-web.xml, etc.