不能换掉原有代码,如果有接口的话就更好了,没有接口最好加个接口!这个时候才理解接口的好处额!
用注解来升级
package com.crm.net.constant;
public class Comm {
/** 切换用户中心实现 需切注解 bean **/
//public static final String SWITCH_IMPLE = ""; // 为空默认为老系统
public static final String SWITCH_IMPLE = "NetImpl";
/** 用户中心 系统id **/
public static final String SYS_ID = "1";
}
@Resource(name = "menuDao" + Comm.SWITCH_IMPLE)
private IMenuDao menuDao;
/**
* 用户中心数据切换到.net管理
*
* @author
* @since 1.0
* @deprecated Please migrate to {@link com.crm.net.dao.impl.MenuDaoNetImpl} for
* crm 2.x.
*/
@Deprecated
@Repository("menuDao")
public class MenuDao implements IMenuDao {
/**
*
* @author liangrui
* @date 2015/01/19
* @since 2.0
* netApi 获取菜单列表实现
*
*/
@Repository("menuDaoNetImpl")
public class MenuDaoNetImpl implements IMenuDao {
有用的注解,参考jackson的一点
/**
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter HttpMessageConverter} that
* can read and write JSON using <a href="http://jackson.codehaus.org/">Jackson 1.x's</a> {@link ObjectMapper}.
*
* <p>This converter can be used to bind to typed beans, or untyped {@link java.util.HashMap HashMap} instances.
*
* <p>By default, this converter supports {@code application/json}. This can be overridden by setting the
* {@link #setSupportedMediaTypes supportedMediaTypes} property.
*
* <p><b>NOTE:</b> Requires Jackson 1.8 or higher, as of Spring 4.0.
* At the same time, we strongly recommend a migration to Jackson 2.x!
*
* @author Arjen Poutsma
* @author Juergen Hoeller
* @since 3.0
* @deprecated Please migrate to {@link MappingJackson2HttpMessageConverter} for Jackson 2.x.
*/
@Deprecated
public class MappingJacksonHttpMessageConverter extends AbstractHttpMessageConverter<Object>
implements GenericHttpMessageConverter<Object> {
/**
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter HttpMessageConverter} that
* can read and write JSON using <a href="http://jackson.codehaus.org/">Jackson 2.x's</a> {@link ObjectMapper}.
*
* <p>This converter can be used to bind to typed beans, or untyped {@link java.util.HashMap HashMap} instances.
*
* <p>By default, this converter supports {@code application/json}. This can be overridden by setting the
* {@link #setSupportedMediaTypes supportedMediaTypes} property.
*
* <p>Tested against Jackson 2.2 and 2.3; compatible with Jackson 2.0 and higher.
*
* @author Arjen Poutsma
* @author Keith Donald
* @author Rossen Stoyanchev
* @author Juergen Hoeller
* @since 3.1.2
*/
public class MappingJackson2HttpMessageConverter extends AbstractHttpMessageConverter<Object>
implements GenericHttpMessageConverter<Object> {