Watch 7 Star 19 Fork 7

苦涩的决断 / jfinal-plusJava

Sign up for free
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
jfinal 增强 spread retract

Clone or download 1.69 KB
Copy Edit Web IDE Raw Blame History

#jfinal-plus-spring 作用于 spring 和 jfinal ioc plugin。 支持 ioc @Inject @Value @Autowired ioc @Resource

#使用 Maven


1、JFinalConfig 配置

public class HelloJFinalConfig extends JFinalConfig {

	private ApplicationContext ctx;
	public void configConstant(Constants me) {
		// 需要 web.xml 配置 org.springframework.web.context.ContextLoaderListener
		IocKit.processJFinalConfig(this);// or IocKit.processJFinalConfig(this,ctx);
	public void configPlugin(Plugins me) {
		me.add(new SpringPlugin(ctx));

2、创建 Interceptor (由于 2.0之前和2.0 的版本有区别所用不提供 Ioc 对象,需自己创建)如:

// jfinal v2.0 之前
public class IocInterceptor implements Interceptor {

	public void intercept(ActionInvocation ai) {


public class HelloController extends Controller {
	// @Autowired 
	ApplicationContext ctx;

	public void setApplicationContext(ApplicationContext ctx) {
		System.out.println("HelloController attr[ApplicationContext] 已注入。。");


Comment ( 0 )

You need to Sign in for post a comment

Help Search

Gitee_you_jiang_zheng_wen Zheng_wen_close