com.zusmart.sample.BootStrap Maven / Gradle / Ivy
The newest version!
package com.zusmart.sample;
import com.zusmart.inject.annotation.Bean;
import com.zusmart.inject.annotation.Configuration;
import com.zusmart.inject.annotation.ImportResource;
import com.zusmart.inject.context.ApplicationContext;
import com.zusmart.inject.context.support.ApplicationContextForAnnotation;
import com.zusmart.sample.biz.MemberBiz;
import com.zusmart.sample.kit.Formater;
@Configuration
@ImportResource("/application.properties")
public class BootStrap {
public static void main(String[] args) throws Exception {
ApplicationContext applicationContext = new ApplicationContextForAnnotation(args,BootStrap.class);
applicationContext.start();
// System.out.println(applicationContext.getBean(DepartmentBiz.class));
// MemberBiz biz = applicationContext.getBean(MemberBiz.class);
// biz.addMember("hekko");
// applicationContext.getBean(MemberBiz.class).addMember("张三");
applicationContext.getBean(MemberBiz.class).addMember("张三丰");
//
// System.out.println(applicationContext.getBean(RoleBiz.class).getName());
System.in.read();
applicationContext.close();
}
@Bean
public Formater formater(){
return new Formater();
}
}