简体   繁体   English

如何将新模板添加到现有的Java类

[英]How to add new template to existing java class

I have a Spring Boot Application in Spring tool suite. 我在Spring工具套件中有一个Spring Boot Application。 I have a template that I want to apply on this project to get copyright header and other default stuff. 我有一个模板,希望将此模板应用于此项目,以获取版权标头和其他默认内容。

I did import as show in the below image. 我确实按照下图所示导入。 Now I am not sure how to apply on existing Java classes. 现在,我不确定如何在现有的Java类上应用。 My new classes are picking up the template but not the existing files. 我的新班级正在学习模板,而不是现有文件。

在此处输入图片说明

How can my existing classes in my project pick up this template. 我项目中现有的班级如何挑选该模板。 I tried source format. 我尝试了源格式。 It didn't help. 它没有帮助。

The code templates are used for new classes/files only, not for existing classes. 代码模板仅用于新类/文件,而不用于现有类。 You can use a different tool. 您可以使用其他工具。

For example Eclipse Releng Tools, described here: https://wiki.eclipse.org/Development_Resources/How_to_Use_Eclipse_Copyright_Tool 例如,此处描述了Eclipse Releng工具: https ://wiki.eclipse.org/Development_Resources/How_to_Use_Eclipse_Copyright_Tool

or: 要么:

http://www.codejava.net/ides/eclipse/how-to-add-copyright-license-header-for-java-source-files-in-eclipse http://www.codejava.net/ides/eclipse/how-to-add-copyright-license-header-for-java-source-files-in-eclipse

Or Copyright Wizard, as described here: https://www.mkyong.com/eclipse/how-to-add-copyright-to-eclipse-automatically/ 或版权向导,如下所述: https : //www.mkyong.com/eclipse/how-to-add-copyright-to-eclipse-automatically/

Hope this helps!!! 希望这可以帮助!!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM