DWR integration in and spring, when, in the dwr.xml will set creator = "spring", to tell dwr will use dwr to org.directwebremoting.spring.SpringCreator to create an object instance, but it is inappropriate to deal SpringCreator.getType, let Let's take a look at its source [dwr-3.0.0.116]:

public Class <?> getType ()
(
if (clazz == null)
(
try
(
clazz = getInstance (). getClass ();
)
catch (InstantiationException ex)
(
log.error ( "Failed to instansiate object to detect type.", ex);
return Object.class;
)
)

return clazz;
)

Let us now take a look at it getInstance, ultimately by the spring to create an instance.

public Object getInstance () throws InstantiationException
(
try
(
if (overrideFactory! = null)
(
return overrideFactory.getBean (beanName);
)

if (factory == null)
(
factory = getBeanFactory ();
)

if (factory == null)
(
log.error ( "DWR can't find a spring config. See following info logs for solutions");
log.info ( "- Option 1. In dwr.xml, <create creator='spring' ...> add <param name='location1' value='beans.xml'/> for each spring config file.") ;
log.info ( "- Option 2. Use a spring org.springframework.web.context.ContextLoaderListener.");
log.info ( "- Option 3. Call SpringCreator.setOverrideBeanFactory () from your web-app");
throw new InstantiationException ( "DWR can't find a spring config. See the logs for solutions");
)

return factory.getBean (beanName);
)
catch (InstantiationException ex)
(
throw ex;
)
catch (Exception ex)
(
throw new InstantiationException ( "Illegal Access to default constructor on" + clazz.getName () + "due to:" + ex);
)
)

getInstance will return from the spring to create an instance, it is clear SpringCreator.getType a bit superfluous, it created the first instance, and then get the object from the instance of the type of getClass, while the spring's beanFactory.getType also have this feature, but it does not require prior Create an instance.

Perhaps writing the code of someone who does not know of this method in spring beanFactory.getType!

I SpringCreator.getType corrected code is as follows:

public Class <?> getType ()
(
if (clazz == null)
(
try
(
if (overrideFactory! = null) (
clazz = overrideFactory.getType (beanName);
) else (
if (factory == null)
factory = getBeanFactory ();
clazz = factory.getType (beanName);
)
)
catch (Exception ex)
(
log.error ( "Failed to detect type.", ex);
return Object.class;
)
)

return clazz;
)