Skip to content

Instantly share code, notes, and snippets.

@aliencode
aliencode / Environment .java
Created August 7, 2013 05:05
Spring获取当前运行环境
@Autowired
Environment env;
@aliencode
aliencode / build.gradle
Created August 7, 2013 06:40
Gradle TestNg 指定 suite 文件
test {
useTestNG(){
suites(file('src/test/resources/testng.xml'))
}
}
@aliencode
aliencode / properties.java
Created August 11, 2013 03:37
Java properties 文件读取
Properties prop = new Properties();
try {
prop.load(this.getClass().getClassLoader().getResourceAsStream("properties/application.routing.properties"));
} catch (IOException e) {
e.printStackTrace();
}
prop.getProperty(strVal, strVal);
@aliencode
aliencode / 1.md
Created August 17, 2013 04:58
github markdown table
  dog | bird | cat
  ----|------|----
  foo | foo  | foo
  bar | bar  | bar
  baz | baz  | baz

dog | bird | cat

@aliencode
aliencode / 1.css
Created August 17, 2013 06:47
CSS移除输入框焦点高亮边框
textarea:focus, input:focus{
outline: 0;
}
@aliencode
aliencode / textarea.css
Created August 17, 2013 11:34
Textarea 禁用缩放功能
textarea {
resize: none;
}
/*Or, if need only vertical resize:*/
textarea {
resize: vertical;
}
@aliencode
aliencode / random.java
Created September 2, 2013 02:34
JAVA随机数
//1000 - 9999
Random generator = new Random();
int id = generator.nextInt(9999) + 1000;
@aliencode
aliencode / factorybean.java
Created September 2, 2013 03:48
Spring获取factory bean本身
//加前缀&
getBean("&factorybeanid")
@aliencode
aliencode / property-placeholder.md
Last active December 22, 2015 08:39
Spring context:property-placeholder 加载顺序和覆盖

##设定加载顺序,数字大的优先加载

<context:property-placeholder location="classpath*:/context2.properties" order="0"/>
<context:property-placeholder location="classpath*:/context.properties" order="100"/>

context2.properties将覆盖context.properties中的值。

##覆盖其它properties

@aliencode
aliencode / servlet.md
Created September 9, 2013 09:24
SERVLET3.0 注解

##注册一个servlet

@WebServlet(name = "captcha-servlet", value = "/getcaptcha")
public class CaptchaServlet extends HttpServlet {

}

GenericServlet要使用HttpServlet