Specify a package instead of “classesToBeBound” for spring Jaxb2Marshaller

前端 未结 3 518
深忆病人
深忆病人 2021-02-13 13:21

I am trying to use Jaxb2Marshaller to marshal a set of java classes using spring. I know this can be done using the following code



        
3条回答
  •  无人及你
    2021-02-13 14:08

    From Spring 3.1 (i think) you can use also the packagesToScan property, which accepts wildcards. It just doesn't work with elements without the @XmlRootElement annotation, just like the contextPath property. These need generated object-factory.

    Could look like:

    
        
            com.test.*
            com.*.test
        
    
    

提交回复
热议问题