Skip to main content

Posts

Showing posts from July, 2013

Which way isAssignableFrom ?

Between java auto boxed types and primitive data types, which way is the class assignable from? Simple.

Long ln = 1L; //autoboxing (assignable) assertTrue(Number.class.isAssignableFrom(ln.getClass())); assertTrue(Long.class.isAssignableFrom(ln.getClass())); assertFalse(long.class.isAssignableFrom(ln.getClass()));

Enable alwaysUseFullPath with mvc:annotation-driven

mvc:annotation-driven doesnot have alwaysUseFullPath attribute. However, in instances this is needed, adding the following bean BEFORE mvc:annnotation-driven tag will set up the alwaysUseFullPath correctly

<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" id="handlerMapping">         <property name="alwaysUseFullPath" value="true"> </property></bean>
So the fuller xml should like this
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" id="handlerMapping">         <property name="alwaysUseFullPath" value="true">     </property></bean>  <mvc:annotation-driven>   <mvc:message-converters>    <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">     <property name="objectMapper" ref="jacksonOb…