I havea spring based java app that I am currently developing Long story short - here is the code I use to retrieve an object from the db, do some calculations on the same and render it
@RequestMapping(value = { "/mapping" }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Object getMasterAppMappingById(
@PathVariable(value = "masterAppId") Integer masterAppId) {
RestBaseVO masterAppMappingRestBaseVO = new RestBaseVO();
MasterAppMappingTreeDetailsVO masterAppMappingTreeDetailsById = applicationDeviceServices.getMasterAppMappingTreeDetails(masterAppId, true);
return masterAppMappingTreeDetailsById;
}
The problem I have is, the code is fine right up until jackson kicks in and converts it. At the return statement is my bottleneck
The method getMasterAppMappingTreeDetails works perfectly and performs well
The json that is rendered by jackson is shown at the following url on pastebin http://pastebin.com/erRDtweZ
As you can see - it is fairly big
The classes being serialized are as follows
public class MasterAppMappingTreeDetailsVO {
@JsonProperty("id")
private Integer id;
@JsonProperty("mappingId")
private Integer mappingId;
@JsonProperty("parentMappingId")
private Integer parentMappingId;
@JsonProperty("isQuestion")
private boolean isQuestion;
@JsonProperty("isAnswer")
private boolean isAnswer;
@JsonProperty("isApplication")
private boolean isApplication;
@JsonProperty("displayLabel")
private String displayLabel;
@JsonProperty("additionalText1")
private String additionalText1;
@JsonProperty("imageUrl")
private String imageUrl;
@JsonProperty("imageDateUpdated")
private Long imageDateUpdated;
@JsonProperty("appId")
private Integer appId;
@JsonProperty("appName")
private String appName;
@JsonProperty("children")
private List<MasterAppMappingTreeDetailsVO> children;
@JsonProperty("menuStyle")
private MenuStyleVO menuStyle;
}
@Entity
@Table(name = "menu_style")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class MenuStyleVO extends BaseDAOVO implements Serializable{
/**
*
*/
private static final long serialVersionUID = 3697798179195096156L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", unique = true, nullable = false)
private Integer id;
@Column(name = "menuStyleName", unique = false, nullable = false, length = 200)
private String menuStyleName;
@Column(name = "menuTemplate", unique = false, nullable = false, length = 200)
private String menuTemplate;
@OneToOne(fetch = FetchType.EAGER)
@Cascade({ CascadeType.SAVE_UPDATE })
@JoinColumn(name="logo_id")
@JsonProperty("logo")
private ApplicationImageVO logo;
@Column(name = "logoAlignment", unique = false, nullable = true, length = 20)
private String logoAlignment;
@Column(name = "backArrowColor", unique = false, nullable = true, length = 7)
private String backArrowColor;
@OneToOne(fetch = FetchType.EAGER)
@Cascade({ CascadeType.SAVE_UPDATE })
@JoinColumn(name="backArrowIcon_id")
@JsonProperty("backArrowIcon")
private ApplicationImageVO backArrowIcon;
@Column(name = "questionLabelTextColor", unique = false, nullable = true, length = 7)
private String questionLabelTextColor;
@Column(name = "headerBackgroundColor", unique = false, nullable = true, length = 7)
private String headerBackgroundColor;
@Column(name = "headerBackgroundOpacity", unique = false, nullable = true)
private Integer headerBackgroundOpacity;
@Column(name = "mainBackgroundColor", unique = false, nullable = true, length = 7)
private String mainBackgroundColor;
@Column(name = "mainBackgroundOpacity", unique = false, nullable = true)
private Integer mainBackgroundOpacity;
@OneToOne(fetch = FetchType.EAGER)
@Cascade({ CascadeType.SAVE_UPDATE })
@JoinColumn(name="backgroundImageLandscape_id")
@JsonProperty("backgroundImageLandscape")
private ApplicationImageVO backgroundImageLandscape;
@OneToOne(fetch = FetchType.EAGER)
@Cascade({ CascadeType.SAVE_UPDATE })
@JoinColumn(name="backgroundImagePortrait_id")
@JsonProperty("backgroundImagePortrait")
private ApplicationImageVO backgroundImagePortrait;
@Column(name = "containerColor", unique = false, nullable = true, length = 7)
private String containerColor;
@Column(name = "containerOpacity", unique = false, nullable = true)
private Integer containerOpacity;
@Column(name = "containerLineDividerColor", unique = false, nullable = true, length = 7)
private String containerLineDividerColor;
@Column(name = "containerLineDividerOpacity", unique = false, nullable = true)
private Integer containerLineDividerOpacity;
@Column(name = "optionIconSize", unique = false, nullable = true)
private Integer optionIconSize;
@Column(name = "optionLabelTextColor", unique = false, nullable = true, length = 7)
private String optionLabelTextColor;
@Column(name = "optionTaglinePosition", unique = false, nullable = true, length = 20)
private String optionTaglinePosition;
@Column(name = "optionTaglineTextColor", unique = false, nullable = true, length = 7)
private String optionTaglineTextColor;
@Column(name = "optionSelectionArrowColor", unique = false, nullable = true, length = 7)
private String optionSelectionArrowColor;
@OneToOne(fetch = FetchType.EAGER)
@Cascade({ CascadeType.SAVE_UPDATE })
@JoinColumn(name="optionSelectionArrowIcon_id")
@JsonProperty("optionSelectionArrowIcon")
private ApplicationImageVO optionSelectionArrowIcon;
}
Can anyone offer any advise on how to improve the performance of this json call or how to improve jackson performance in general for my application?