Skip to content
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

Merged
merged 4 commits into from
Nov 10, 2014
Merged

Adding documentation about beans.xml. Closes #815. #871

merged 4 commits into from
Nov 10, 2014

Conversation

garcia-jj
Copy link
Member

No description provided.

@@ -27,6 +27,18 @@
</listener>
~~~

And the optional `beans.xml` file located under your `WEB-INF` folder with this content:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it really optional?

Copy link
Member Author

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.

Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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_archive

Java 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.

Copy link
Member Author

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.

Copy link
Member Author

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

Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@csokol Docs fixes with your suggestions. b4b844b and f1048a4.

garcia-jj added a commit that referenced this pull request Nov 10, 2014
Adding documentation about beans.xml. Closes #815.
@garcia-jj garcia-jj merged commit ba8d016 into caelum:master Nov 10, 2014
@garcia-jj garcia-jj deleted the ot-gh815-beansxml branch November 10, 2014 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants