Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.
DirkMahler edited this page Mar 7, 2013 · 4 revisions

JAXBbeans is a CDI (Contexts and Dependency Injection, JSR-299) extension which provides JAXBContext instances based on the existence of qualifier annotations.

##License JAXBbeans is provided under Apache License 2.0.

##Getting started

###Get the artifact The official release is available from the Maven repository of buschmais GbR. Add the following snippet to your pom.xml:

<repositories>
  <repository>
    <id>buschmais-releases</id>
    <url>http://nexus.buschmais.com/content/repositories/releases/</url>
  </repository>
</repositories>

Now add the following dependency thus it becomes available for the java compiler and will be packaged into your deployable artifact (WAR or EAR file):

<dependency>
  <groupId>com.buschmais.jaxbbeans</groupId>
  <artifactId>jaxbbeans.extension</artifactId>
  <version>1.0.0</version>
</dependency>

###Define your JAXB beans Create a qualifier using the meta annotation JAXBClasses and add the classes which shall be used to create the JAXBContext:

@JAXBClasses(ObjectFactory.class)
@Qualifier
@Retention(RUNTIME)
public @interface Configuration {
}

###Inject Now you can - without any producer field or method - inject the JAXBContext into your beans:

public class ConfigReader {
  @Inject
  @Configuration
  private JAXBContext jaxbContext;
}

##Feature requests and bug reporting If bugs appear you may raise issues here .

Suggestions or feedback are welcome and may be provided to dirk.mahler (at) buschmais.com.

Enjoy!

Clone this wiki locally