本文整理汇总了Java中org.nutz.ioc.Ioc类的典型用法代码示例。如果您正苦于以下问题:Java Ioc类的具体用法?Java Ioc怎么用?Java Ioc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Ioc类属于org.nutz.ioc包,在下文中一共展示了Ioc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: make
import org.nutz.ioc.Ioc; //导入依赖的package包/类
public View make(Ioc ioc, String type, String value) {
if ("fm".equalsIgnoreCase(type) || "ftl".equalsIgnoreCase(type)) {
if (freeMarkerConfigurer == null) {
for (String name : ioc.getNames()) {
if (iocName.equals(name)) {
freeMarkerConfigurer = ioc.get(FreeMarkerConfigurer.class);
break;
}
}
if (freeMarkerConfigurer == null) {
Configuration configuration = new Configuration();
freeMarkerConfigurer = new FreeMarkerConfigurer(configuration, Mvcs.getServletContext(),"WEB-INF", ".html", null);
freeMarkerConfigurer.init();
}
}
return new WindowsFreemarkerView(freeMarkerConfigurer, value);
}
return null;
}
示例2: getTemplateShareVars
import org.nutz.ioc.Ioc; //导入依赖的package包/类
/**
* 模板引擎共用的变量
*/
public static NutMap getTemplateShareVars() {
NutMap share = new NutMap();
Ioc ioc = Mvcs.getIoc();
share.put("ioc", ioc);
PropertiesProxy conf = ioc.get(PropertiesProxy.class, "conf");
share.put("conf", conf.toMap());
if (!conf.getBoolean("cdn.enable", false) || Strings.isBlank(conf.get("cdn.urlbase"))) {
share.put("cdnbase", "");
} else {
share.put("cdnbase", conf.get("cdn.urlbase"));
}
return share;
}
示例3: init
import org.nutz.ioc.Ioc; //导入依赖的package包/类
@Override
public void init(NutConfig nc) {
Ioc ioc = nc.getIoc();
ioc.get(NutQuartzCronJobFactory.class);
Dao dao = ioc.get(Dao.class);
Daos.createTablesInPackage(dao, "com.yjh", false);
}
示例4: getIoc
import org.nutz.ioc.Ioc; //导入依赖的package包/类
public Ioc getIoc(){
if(ioc == null){
ioc = Mvcs.getIoc();
}else if(ioc == null){
ioc = Mvcs.ctx().getDefaultIoc();
}
return ioc;
}
示例5: make
import org.nutz.ioc.Ioc; //导入依赖的package包/类
@Override
public View make(Ioc ioc, String type, String value) {
if (VIEW_FREEMAKER.equals(type)) {
return new FreeMakerView(value);
}
return super.make(ioc, type, value);
}
示例6: dao
import org.nutz.ioc.Ioc; //导入依赖的package包/类
private Dao dao() {
if (null == dao) {
Ioc ioc = Mvcs.getIoc();
if (null == ioc)
ioc = Mvcs.ctx.getDefaultIoc();
dao = ioc.get(Dao.class);
}
return dao;
}
示例7: init
import org.nutz.ioc.Ioc; //导入依赖的package包/类
public void init(NutConfig conf) {
Ioc ioc = conf.getIoc();
Dao dao = ioc.get(Dao.class);
Daos.createTablesInPackage(dao, "com.window", false);
// 初始化默认根用户
if (dao.count(User.class) == 0) {
User user = new User();
user.setName("admin");
user.setPassword("123456");
user.setCreateTime(new Date(System.currentTimeMillis()));
user.setUpdateTime(new Date(System.currentTimeMillis()));
dao.insert(user);
}
}
示例8: create
import org.nutz.ioc.Ioc; //导入依赖的package包/类
public Ioc create(NutConfig nc, String[] paths) {
if (nc == null || Lang.length(paths) > 0)
return new SpringIoc(paths);
else {
return new SpringIoc(nc);
}
}
示例9: init
import org.nutz.ioc.Ioc; //导入依赖的package包/类
@Override
public void init(NutConfig nc) {
Ioc ioc = nc.getIoc();
Dao dao = ioc.get(Dao.class);
Daos.createTablesInPackage(dao, WxUser.class.getPackage().toString(), false);
// PropertiesProxy pp = ioc.get(PropertiesProxy.class, "config");
// 按需选择
ResourceService resourceService = null;
// try {
// SSDB ssdb = SSDBs.pool("127.0.0.1", 8888, 5000, null);
// resourceService = new SsdbResourceService(ssdb);
// ((Ioc2)ioc).getIocContext().save("app", "resourceService", new ObjectProxy(resourceService));
// } catch (Exception e) {
// log.info("fail to connect ssdb? using DaoResourceService now", e);
resourceService = new DaoResourceService(dao);
((Ioc2)ioc).getIocContext().save("app", "resourceService", new ObjectProxy(resourceService));
// }
// try {
// scheduler = StdSchedulerFactory.getDefaultScheduler();
// scheduler.startDelayed(5000);;
// } catch (SchedulerException e) {
// log.warn("Scheduler start fail", e);
// }
}
示例10: make
import org.nutz.ioc.Ioc; //导入依赖的package包/类
/**
* @param ioc ioc容器
* @param type 类型
* @param value 值
* @return 视图
*/
public View make(Ioc ioc, String type, String value) {
if ("fm".equalsIgnoreCase(type)) {
return new FreemarkerView(value);
}
return null;
}
示例11: make
import org.nutz.ioc.Ioc; //导入依赖的package包/类
@Override
public View make(Ioc ioc, String type, final String value) {
if (JetWebEngineLoader.getTemplateSuffix().equals(type)) {
return new JetTemplateView(value);
}
return null;
}
示例12: getIoc
import org.nutz.ioc.Ioc; //导入依赖的package包/类
private Ioc getIoc() {
if(this.ioc == null) {
this.ioc=Mvcs.getIoc();
}
return this.ioc;
}
示例13: makeIt
import org.nutz.ioc.Ioc; //导入依赖的package包/类
public List<? extends MethodInterceptor> makeIt(CacheDelete cache, Method method, Ioc ioc) {
return Arrays.asList(new DelCacheAopInterceptor(ioc.get(AbstractCacheManager.class, "cachePointCut"), cache, method));
}
示例14: makeIt
import org.nutz.ioc.Ioc; //导入依赖的package包/类
public List<? extends MethodInterceptor> makeIt(Cache cache, Method method, Ioc ioc) {
return Arrays.asList(new AutoLoadCacheAopInterceptor(ioc.get(AbstractCacheManager.class, "cachePointCut"), cache, method));
}
示例15: make
import org.nutz.ioc.Ioc; //导入依赖的package包/类
public View make(Ioc ioc, String type, String value) {
if (!"wx".equals(type))
return null;
return WxView.me;
}