博文

目前显示的是 十月, 2013的博文

Spring - context:annotation-config 与 context:component-scan 的区别与使用

<context:annotation-config> is used to activate annotations in beans already registered in the application context (no matter if they were defined with XML or by package scanning <context:component-scan> can also activate annotations in beans but also scans packages to find and register beans within the application context. To use annotations like @Required, @Autowired etc you need at least <context:annotation-config> that is because "annotations are a nice feature but by themselves they do nothing whatsoever. They just annotate stuff. You need a processing tool to find the annotations and do something with them. <context:annotation-config> to the rescue. This activates the actions for the annotations that it finds on the beans defined in the same application context where itself is defined." But since <context:annotation-config> only works with beans that has already been registered. If we don't manually register those beans in ...

Config remote debug for tomcat hosted web application

Modify your tomcat startup script (startup.bat): Add this at the beginnng of startup.bat script set JPDA_ADDRESS=8000 set JPDA_TRANSPORT=dt_socket Replace  "call %EXECUTABLE%" start %CMD_LINE_ARGS%" to "call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%" Now tomcat start with opening port 8000 for debugging. Configure eclipse debug: In Run > Debug Configurations add a new debug configuration by selecting 'Remote Java Application' Use port 8000 and select the correct project to debug

Use sublime text from cygwin

Cygwin echo 'alias sublime="/cygdrive/c/Tools/sublime/sublime_text.exe""' >> ~/.bashrc

常用 JVM parameters

Read more:  http://javarevisited.blogspot.dk/2011/11/hotspot-jvm-options-java-examples.html

在Eclipse中使用RegEx

Eclipse中的regular expression语法 http://www.eclipse.org/tptp/home/downloads/installguide/gla_42/ref/rregexp.html 使用grouped的RegEx替换 有如下text: new String("abc"); new String("123"); new String("JKL"); 使用这个regex: new\sString\(\"(.*)\"\) 进行match, 然后再替换为: \"$1\" 就可以一次完成 new String 的去除。