Two uses that eclipse should know: automatic generation of interfaces and JUnit test classes

Source: Internet
Author: User

(3) automatically generates its interface through a class:

In spring applications, we often use the "interface + implementation Class" form, that is, to implement a class and write a method similar to the interface, sometimes feel more cumbersome. In fact, eclipse can automatically extract interfaces from a class.

The code for Personserviceimpl.java is as follows:

Right-click in the blank of the above code, or right-click on the Personserviceimpl class name-> refactor–> Extract Interface, as shown in the following figure:

In the Extract Interface dialog box, enter the interface name in the Interface Name box: Personservice, select the Addperson and Queryperson methods, as shown in the following figure:

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.