1.直接输入路径 已maven项目为例,直接输入路径的4种方式,即是File类支持的方式: /** * FileOutpurStream以字节数组方式写入文件 * @throws IOException */ @Test public void testFileOutputStramBytes() throws IOException{ // String path = "src/main/resources/write.data"; String path = "write…
git提交代码出现错误fatal: Unable to create '项目路径/.git/index.lock': File exists. 具体出错代码如下: 具体原因不详,在stackoverflow上查找了很久,也不清楚原因,但是stackoverflow给出了解决的方法. 解决方法: 在当前项目下打开git bash,运行如下命令: rm -f ./.Git/index.lock 只为成功找方法.大胆的尝试,下一个fun就是你的fun!…
1. controller类: package com.neo.controller; import javax.servlet.http.HttpServletResponse; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.ann…
没有java标志,不识别为Java项目,右键项目-->Properties-->Project Facets-->勾选Java   确定就可以了. 没有maven Dependencies 从其他有maven Dependencies的项目下,找到.project文件,打开,把 <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/> 复…
内部类的拓展 定义类or方法内部的类 最外层的类只能使用public和默认修饰 class Demo { class A { } public static void main(String[] args) { class B { } int a; } } 示例2: class Demo { //成员变量属于类的对象,只有类的对象存在时成员变量才存在 private int bb; class A { } public static void main(String[] args) { Demo…
1.在项目上点击右键=>properties,在Project Facets配置项中,勾选Dynamic Web Module.Java.JavaScript选项. 2.用记事本打开项目目录下的.project文件. 在<natures> </natures>代码段中加入如下内容并保存: <nature>org.eclipse.wst.common.project.facet.core.nature</nature> <nature>org…
再pom文件中加上 <build> <resources> <resource> <directory>src/main/java</directory> --------------------------------xml和properties所在包 <includes> <include>**/*.properties</include> <include>**/*.xml</inclu…
先收集几个网址,后续再自己动手过一遍 http://www.cnblogs.com/sunzhenchao/archive/2013/01/30/2883289.html https://my.oschina.net/denglz/blog/524154 http://blog.csdn.net/haiyang4988/article/details/53043695 http://mousycoder.com/2015/10/14/jenkins-git-maven-shell-tomcat-…
很多时候我们都会碰到需要在程序启动时去执行的方法,比如说去读取某个配置,预加载缓存,定时任务的初始化等.这里给出几种解决方案供大家参考. 1. 使用@PostConstruct注解 这个注解呢,可以在Spring加载这个类的时候执行一次.来看一下下方代码. 123456789101112131415161718192021 @Componentpublic class Test { public Test(){ System.out.println("我最先执行"); } /** *我…