java 老系统升级 换掉原有类的小方法和有用的注解


不能换掉原有代码,如果有接口的话就更好了,没有接口最好加个接口!这个时候才理解接口的好处额!

用注解来升级

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> {



  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值