eclipse 自动注释设置

1、eclipse 自动注释设置
Eclipse–>偏好设置–>Java–>Code Sytle–>Code Templates

eclipse 自动注释设置_第1张图片

Code Templates弹出窗口中,Comments下面选Types,点Edit按钮
eclipse 自动注释设置_第2张图片
在Template Edit窗口输入

/**
 * @Description ${todo}(这里用一句话描述这个类的作用)
 * @author ${user}
 * @Date ${date} ${time}
 * @version 1.0.0
 * ${tags}
 */

eclipse 自动注释设置_第3张图片

同样方法编辑Fields

/**
 * @Field @${field} : ${todo}(这里用一句话描述这个类的作用)
 */

同样方法编辑Methods

/**
 * @Description (${todo}这里用一句话描述这个方法的作用)
 * ${tags}
 */

2、设置eclipse的 userTypes {user},注释会自动显示当author作者。怎样编辑让${user}项显示为你想要的内容呢。如下图
eclipse 自动注释设置_第4张图片
在eclipse的安装目录下,在eclipse.ini文件添加
-vmargs-Duser.name=张三
然后注释的${user}就会自动显示为张三了。
eclipse 自动注释设置_第5张图片

还有一点需要注意:勾选Automatically add comments for new methods and types,在创建类、方法时,会自动生成注释。
eclipse 自动注释设置_第6张图片

你可能感兴趣的:(java,eclipse)