- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {Connection c =
DataSource dataSource;dataSource.getConnection()
String url;DriverManager.getConnection(url)
IdentityDatabaseUtil.getDBConnection()
- Smart code suggestions by Codota
}
/** * Set freemarker's property. * The value of template_update_delay is 5 seconds. * Example: FreeMarkerRender.setProperty("template_update_delay", "1600"); */ public static void setProperty(String propertyName, String propertyValue) { try { FreeMarkerRender.getConfiguration().setSetting(propertyName, propertyValue); } catch (TemplateException e) { throw new RuntimeException(e); } }
public static void setProperties(Properties properties) { try { FreeMarkerRender.getConfiguration().setSettings(properties); } catch (TemplateException e) { throw new RuntimeException(e); } }
/** * 注入对象到 FreeMarker 页面供调用,通常注入一些辅助内容输出的工具类,相当于是 freemarker 的一种扩展方式 * @param name 对象名 * @param object 对象 */ public static void setSharedVariable(String name, Object object) { try { FreeMarkerRender.getConfiguration().setSharedVariable(name, object); } catch (TemplateException e) { throw new RuntimeException(e); } }
/** * 注入对象到 FreeMarker 页面供调用,通常注入一些辅助内容输出的工具类,相当于是 freemarker 的一种扩展方式 * @param name 对象名 * @param object 对象 */ public static void setSharedVariable(String name, Object object) { try { FreeMarkerRender.getConfiguration().setSharedVariable(name, object); } catch (TemplateException e) { throw new RuntimeException(e); } }
/** * Set freemarker's property. * The value of template_update_delay is 5 seconds. * Example: FreeMarkerRender.setProperty("template_update_delay", "1600"); */ public static void setProperty(String propertyName, String propertyValue) { try { FreeMarkerRender.getConfiguration().setSetting(propertyName, propertyValue); } catch (TemplateException e) { throw new RuntimeException(e); } }
/** * Set freemarker's property. * The value of template_update_delay is 5 seconds. * Example: FreeMarkerRender.setProperty("template_update_delay", "1600"); */ public static void setProperty(String propertyName, String propertyValue) { try { FreeMarkerRender.getConfiguration().setSetting(propertyName, propertyValue); } catch (TemplateException e) { throw new RuntimeException(e); } }
public static void setProperties(Properties properties) { try { FreeMarkerRender.getConfiguration().setSettings(properties); } catch (TemplateException e) { throw new RuntimeException(e); } }
public static void setProperties(Properties properties) { try { FreeMarkerRender.getConfiguration().setSettings(properties); } catch (TemplateException e) { throw new RuntimeException(e); } }
private static Configuration initStringConfiguration() { if (stringConfig == null) { //从freemarker 视图中获取所有配置 stringConfig = (Configuration) FreeMarkerRender.getConfiguration().clone(); stringLoader.putTemplate(UPDATE_RESPONSE_TEMPLATE, StringPool.EMPTY); } return stringConfig; }
/** * appConfig配置所有参数 * 重写freemarker中的 reader方法,读取该配置文件 * * @return config */ private static Configuration getAppConfiguration() { if (appConfig == null) { //从freemarker 视图中获取所有配置 appConfig = (Configuration) FreeMarkerRender.getConfiguration().clone(); try { //设置模板路径 appConfig.setDirectoryForTemplateLoading(new File(PathKit.getWebRootPath() + Goja.viewPath)); appConfig.setObjectWrapper(new BeansWrapperBuilder(Configuration.VERSION_2_3_21).build()); } catch (IOException e) { logger.error("The Freemarkers has error!", e); } } return appConfig; }
/** * set freemarker variable. */ private void setFtlSharedVariable() { // custmer variable final Configuration config = FreeMarkerRender.getConfiguration(); config.setSharedVariable("block", new BlockDirective()); config.setSharedVariable("extends", new ExtendsDirective()); config.setSharedVariable("override", new OverrideDirective()); config.setSharedVariable("super", new SuperDirective()); // 增加日期美化指令(类似 几分钟前) config.setSharedVariable("prettytime", new PrettyTimeDirective()); if (GojaConfig.enable_security()) { config.setSharedVariable("shiro", new ShiroTags(config.getObjectWrapper())); } }