All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ajaxjs.config.InitConfig Maven / Gradle / Ivy

Go to download

AJAXJS aims to full-stack, not only the server-side framework, but also integrates the front-end library. It'€™s written in HTML5 + Java, a successor to the JVM platform, efficient, secure, stable, cross-platform and many other advantages, but it abandoned the traditional enterprise architecture brought about by the large and bloated, emphasizing the lightweight, and fast, very suitable for the Internet fast application.

The newest version!
package com.ajaxjs.config;

import javax.servlet.ServletContext;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.ServletContextAware;

import com.ajaxjs.Version;
//import com.ajaxjs.website.stru.SiteStruService;

/**
 * 配置中心的启动入口 https://www.cnblogs.com/yihuihui/p/12034522.html
 * 
 * @author sp42 [email protected]
 */
@Component
public class InitConfig implements ServletContextAware {
	@Autowired
	private ConfigService cfg;
	@Autowired
	private GetConfig _cfg;

	@Override
	public void setServletContext(ServletContext ctx) {
		cfg.init(ctx);

//		SiteStruService.INITIALIZED.accept(ctx);

		// 设置环境变量
		String ctxPath = ctx.getContextPath();
		ctx.setAttribute("ctx", ctxPath);
		ctx.setAttribute("isDebuging", Version.isDebug);
		ctx.setAttribute("commonAsset", ctxPath + "/asset/common"); // 静态资源目录
		ctx.setAttribute("commonAssetIcon", _cfg.get("forDelevelopers.commonAssetIcon")); // 静态资源图标目录
		ctx.setAttribute("ajaxjs_ui_output", "https://ajaxjs.nos-eastchina1.126.net");

		// 开发阶段,ajaxjsui 指定了前端 js 所在的位置,通常是另外一个项目同时运行着,例如当前是本机 8080 端口的 ajaxjs-js。
//		if (Version.isDebug)
//			ctx.setAttribute("developing_js_url", "http://" + Tools.getIp() + ":8888");

		ctx.setAttribute("aj_static_resource", Version.isDebug ? ctx.getAttribute("developing_js_url") : ctxPath + "/asset");
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy