public static JAXBContext get ( final String contextPath ) { Assert . hasText ( contextPath , "contextPath is required" ) ; JAXBContext ctx = jaxbContexts . get ( contextPath ) ; if ( ctx == null ) { try { ctx = JAXBContext . newInstance ( contextPath ) ; } catch ( final JAXBException e ) { throw new IllegalArgumentException ( "Failed to create JAXBContext - invalid JAXB context path: " + contextPath , e ) ; } jaxbContexts . put ( contextPath , ctx ) ; LoggerFactory . getLogger ( JAXBContextCache . class ) . info ( "cached : {}" , contextPath ) ; } return ctx ; }
If the JAXBContext is not cached then it will create a new instance and cache it .