Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EclipseLink/Examples/MOXy/BVinJAXB/DisablingBV

< EclipseLink‎ | Examples‎ | MOXy‎ | BVinJAXB
Revision as of 10:15, 29 September 2015 by Marcelv3612.gmail.com (Talk | contribs) (initial version)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Turn BV in JAXB off

By default, BV is in mode AUTO. That means, if BV provider is found on classpath, it is turned on, otherwise it is silently turned off and an informative message is logged.

In order to switch BV off, a property must be passed to either JAXBContext, Marshaller or Unmarshaller.

Example:

 Map<String, BeanValidationMode> props = new HashMap<>();
 props.put(JAXBContextProperties.BEAN_VALIDATION_MODE, BeanValidationMode.NONE);
 Class[] classes = new Class[] { Customer.class };
 JAXBContext jaxbContext = JAXBContext.newInstance(classes, props);



Back to the top