Java old system upgrade small methods and useful annotations to replace the original class

Source: Internet
Author: User
Tags deprecated


Can not replace the original code, if there is an interface is better, no interface is best to add an interface! This is the time to understand the benefits of the interface amount!

Use Annotations to upgrade

Package Com.crm.net.constant;public class Comm {/** Switch User Center implementation   needs to cut the annotation bean **///public static final String switch_imple = ""; Null defaults to old system public  static final string switch_imple = "Netimpl";/** User Center system ID **/public Static final String sys_id = " 1 ";}


@Resource (name = "Menudao" + comm.switch_imple) private Imenudao Menudao;

/** * User Center Data Switch to. NET Management *  * @author  * @since 1.0 * @deprecated please migrate to {@link Com.crm.net.dao.impl.MenuDao Netimpl} for *             CRM 2.x. */@Deprecated @repository ("Menudao") public class Menudao implements Imenudao {

/** *  * @author Liangrui * @date 2015/01/19 * @since 2.0 *          netapi get menu List Implementation * */@Repository ("Menudaonetimpl") public Class Menudaonetimpl implements Imenudao {







Useful annotations, refer to Jackson's point

/** * 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 is 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 Mappingjackson2htt Pmessageconverter} for Jackson 2.x. */@Deprecatedpublic class Mappingjacksonhttpmessageconverter extends Abstracthttpmessageconverter<object>implements generichttpmessageconverter<object> { 

/** * Implementation of {@link Org.springframework.http.converter.HttpMessageConverter httpmessageconverter} that * can read and write JSON us ing <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 is 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 */pu Blic class Mappingjackson2httpmessageconverter extends Abstracthttpmessageconverter<object>implements generichttpmessageconverter<object> {



Java old system upgrade small methods and useful annotations to replace the original class

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.