-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding documentation about beans.xml. Closes #815. #871
Conversation
@@ -27,6 +27,18 @@ | |||
</listener> | |||
~~~ | |||
|
|||
And the optional `beans.xml` file located under your `WEB-INF` folder with this content: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it really optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, is optional as described in CDI spec: http://docs.jboss.org/cdi/spec/1.1/cdi-spec.html#bean_archive
Java EE modules like WAR, JAR, EAR is an "Implicit archive", and CDI is enabled by default even no beans.xml
exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to make this clearer, since we are explaining how to setup the environment to run in a servlet container.
Something like: "And the beans.xml
file located under your web-inf (which is optional in case of application servers) with this content:"
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Servlet containers must consider war as bean archives as I undertood reading the spec. See the link I posted previously. Application must have only one (or more) classes with any scope definition to considered as implicit bean archive, and CDI will activated.
Can you confirm this info? I don't have any application running under a Servlet Container to take a test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this only apply to modules deployed in application servers:
A Java EE container is required by the Java EE specification to support
Java EE modules. Other containers may or may not provide support for war,
EJB jar or rar bean archives.
Anyway, I've tested now I our application and VRaptor didn't scanned the
controllers. By the way, VRaptor is warning as expected:
06:42:06,532 WARN [VRaptor ] A beans.xml isn't found. Check if
is properly located at /WEB-INF/beans.xml or
/WEB-INF/classes/META-INF/beans.xml
Chico Sokol
On Wed, Nov 5, 2014 at 11:06 PM, Otávio Garcia notifications@github.com
wrote:
In vraptor-site/content/en/docs/dependencies-and-prerequisites.html:
@@ -27,6 +27,18 @@
+And the optional `beans.xml` file located under your `WEB-INF` folder with this content:
Yes, is optional as described in CDI spec:
http://docs.jboss.org/cdi/spec/1.1/cdi-spec.html#bean_archiveJava EE modules like WAR, JAR, EAR is an "Implicit archive", and CDI is
enabled by default even no beans.xml exists.—
Reply to this email directly or view it on GitHub
https://github.com/caelum/vraptor4/pull/871/files#r19920062.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@csokol The spec said only "Container", not " Java EE Container". The link
I sent previously can solve your doubt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, OK. The spec said only "Container", so its not too clear for me if run
under Servlet Containers and EE Containers too. But your test allow us to
know the truth. The cdi spec is really too bad :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't quote the whole statement:
A Java EE container is required by the Java EE specification to support Java EE modules. Other containers may or may not provide support for war, EJB jar or rar bean archives.
By that I think that the spec is telling us that outside of a Java EE container anything could happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The text you quoted is really about Java EE, but the previous not. The previous paragraph describe Containers in a generic way:
When determining which archives are bean archives, the container must consider:
Library jars, EJB jars or application client jars
The WEB-INF/classes directory of a war
Directories in the JVM classpath
I'm confused because the spec is too weak/poor. So I agree with you that we need to keep your docs too clear as possible. I'll update the text ASAP. Thanks to discuss this point to clarify our opinions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding documentation about beans.xml. Closes #815.
No description provided.