Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Improving performance of JAXBContext init by using Spring singleton or prototype scope?

 
Jay Dilla
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to unmarshal/marshal a lot of small XMLs, so I'm going to use JaxB. But getting the JAXBContext every time is going to be very expensive.

Instead of Caching through some kind of map I'm thinking of creating a bean for the JAXBContext initialization specifically, giving it singleton or prototype scope and then referencing that bean from the class that's going to manipulate the unmarshalled data. Different schemas could be passed each time so I guess I have to make it prototype scope actually.....

Does this make sense from a design perspective or is there a better way to do this?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic