当 Web 应用集成 Spring 容器后,代表 Spring 容器的WebApplicationContext对象将以 WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE 为键存放在ServletContext的属性列表中.您当然可以直接通过以下语句获取 WebApplicationContext: WebApplicationContext wac = (WebApplicationContext)servletConte
使用该工具类需要从spring开发包中导入spring.jar和commons-logging.jar,这个模板是线程安全的. JdbcTemplate: public class JdbcTemplateTest { static JdbcTemplate jdbc = new JdbcTemplate(JdbcUtils.getDataSource()); /** * @param args */ public static void main
比如说我们需要打印某个方法的User参数对象 package test; /** * * @author zhengtian * @time 2012-6-28 */ public class User { private String name; private int age; public String getName() { return name; } public void setName(String name) { this.name = name; } public int g
DispatcherServlet的静态初始化 /** * Name of the class path resource (relative to the DispatcherServlet class) * that defines DispatcherServlet's default strategy names. */ private static final String DEFAULT_STRATEGIES_PATH = "DispatcherServlet.properties&