Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Annotations not being detected

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

If any one can help me resolve this issue , would really appreciate it.

I am not sure why my spring controller doesn't pick up the @XmlRootElement name and @XmlElement name of the domain objects.

my controller request mapping syntax



public class GetChatUserDetails {

private static final Logger logger = LoggerFactory.getLogger("");
private IGetChatUserDetailService iGetChatUserDetailService;

private MessageSource messageSource;

public ChatUserDetail getUserDetails(ModelMap model,@RequestParam("userId") String userId,@RequestParam("ipaddr") String ipAddr) throws Exception
ChatUserDetail chatUserDetail =null;
logger.debug("in GetUser Details Service");
chatCustDetail = iGetChatUserDetailService.getChatCustDetail(userId, ipAddr);
logger.debug("Returning response to the handler");
catch(Exception ex){
model.addAttribute(Message.MESSAGES, populateMessageObject("livechat.service.error",6002));
logger.error("Error. Error Message: "+ex.getMessage());

return chatCustDetail;

private Object populateMessageObject(String string,int errorCode) {

Message messageObject = new Message();
String messageText = messageSource.getMessage(string,null, null);
messageObject.setText( messageText);
return messageObject;

}//end of class

package com.stock.domain;

import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;

public class ChatUserDetail {

private List<ChatUserAccount> chatUserlist;
private ChatUserLocation userLoc;

public List<ChatUserAccount> getChatUserlist() {
return chatUserlist;
public void setChatUserlist(List<ChatUserAccount> chatUserlist) {
this.chatUserlist = chatUserlist;

public ChatUserLocation getUserLoc() {
return userLoc;
public void setUserLoc(ChatUserLocation userLoc) {
this.userLoc = userLoc;


spring context xml

?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
xmlns:xsi="" xmlns:context=""

<context:component-scan base-package="" />
<context:component-scan base-package="" />
<context:component-scan base-package="" />
<context:annotation-config />
<bean id="messageSource" class="">
<property name="basenames">
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!