Skip to main content
Jump to: navigation, search

EclipseLink/Examples/MOXy/BVinJAXB/DisablingBV

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