操作步骤:打开Window->Preferences->Java->Code Style->Code Templates
如图:
点击“Import”,导入模板codetemplates.xml文件。
附:codetemplates.xml文件内容
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="false" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/**
* <b>项目名:</b>系统项目名称<br/>
* <b>包名:</b>${package_name}<br/>
* <b>文件名:</b>${file_name}<br/>
* <b>版本信息:</b><br/>
* <b>日期:</b>${date}-${time}<br/>
* <b>Copyright (c)</b>${year}XX公司-版权所有<br/>
*
*/</template><template autoinsert="true" context="filecomment_context" deleted="false" description="Comment for created JavaScript files" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name="filecomment">/**
*
*/</template><template autoinsert="true" context="delegatecomment_context" deleted="false" description="Comment for delegate functions" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name="delegatecomment">/**
* ${tags}
* ${see_to_target}
*/</template><template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name="typecomment">/**
* @author kin
*
* ${tags}
*/</template><template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment">/**
*
* <b>类名称:</b>${type_name}<br/>
* <b>类描述:</b><br/>
* <b>创建人:</b>kin<br/>
* <b>修改人:</b>kin<br/>
* <b>修改时间:</b>${date} ${time}<br/>
* <b>修改备注:</b><br/>
* @version 1.0.0<br/>
*
*/</template><template autoinsert="true" context="fieldcomment_context" deleted="false" description="Comment for vars" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name="fieldcomment">/**
*
*/</template><template autoinsert="false" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment">
/**
* 创建一个新的实例 ${enclosing_type}.
*
* ${tags}
*/</template><template autoinsert="true" context="overridecomment_context" deleted="false" description="Comment for overriding functions" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name="overridecomment">/* (non-Jsdoc)
* ${see_to_overridden}
*/</template><template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment">/**
* @param ${param} the ${bare_field_name} to set
*/</template><template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name="settercomment">/**
* @param ${param} the ${bare_field_name} to set
*/</template><template autoinsert="false" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment">/**
* ${bare_field_name}
*
* @return the ${bare_field_name}
* @since 1.0.0
*/
</template><template autoinsert="false" context="methodcomment_context" deleted="false" description="Comment for non-overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment">/**
* ${enclosing_method}(这里用一句话描述这个方法的作用)<br/>
* (这里描述这个方法适用条件 – 可选)<br/>
* ${tags}
*${return_type}
* @exception
* @since 1.0.0
*/</template><template autoinsert="true" context="delegatecomment_context" deleted="false" description="Comment for delegate methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment">/**
* ${tags}
* ${see_to_target}
*/</template><template autoinsert="true" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name="constructorcomment">/**
* ${tags}
*/</template><template autoinsert="true" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment">/* (non-Javadoc)
* ${see_to_overridden}
*/</template><template autoinsert="false" context="fieldcomment_context" deleted="false" description="Comment for fields" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment">/**
* ${field}:${todo}(用一句话描述这个变量表示什么)
*
* @since 1.0.0
*/
</template><template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name="gettercomment">/**
* @return the ${bare_field_name}
*/</template><template autoinsert="true" context="methodcomment_context" deleted="false" description="Comment for non-overriding function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name="methodcomment">/**
* ${tags}
*/</template></templates>
一、jar包的制作
1、maven工程引入下列三个依赖
2、写三个Java文件 和 相应资源包(vue+element)
3、写index.html ,可直接引用本地资源也可cdn 引入,正常编写网页
===================
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app">
<el-button @click="visible = true">Button</el-button>
<el-dialog :visible.sync="visible" title="Hello world">
<p>Try Element</p>
</el-dialog>
</div>
</body>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data: function() {
return { visible: false }
}
})
</script>
</html>
===================
4、InitListener 初始化文件,执行相应初始化动作,可不加
5、MvcConfig配置文件,自动装配bean
6、ThisApi 自定义注解类,并引入MvcConfig.class
7、生成jar包
二、jar包本地引入,并执行
1、新建springboot项目,引入web 和 thymeleaf ,正常执行,并做一个主页进行测试
2、本地引入jar包,在resources下新建lib ,并复制jar包
3、在启动类上,填写注解
4、正常执行,并访问jar中Configuration 中addResourceHandlers 配置的访问路径,就可以访问jar中的静态页面了
三、本地jar引入后打包注意事项
四、获取相关设置(简单通信)
1、InitListener
···
package com.juncheng.syc.listener
import javax.servlet.ServletContextEvent
import javax.servlet.ServletContextListener
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.core.env.Environment
public class InitListener implements ServletContextListener {
}
···
2、设置 application.properties