import com.Config.JdbcUtil;
import com.Config.SpringConfiguration;
import com.Config.TestConfiguration;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidPooledConnection;
import com.entity.User;
import com.service.JwtService;
import com.service.StudentService;
import com.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 使用注解引入容器
 */
public class AnnotationMain {
    public static void main(String[] args) throws Exception{
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(SpringConfiguration.class);
//        Object jdbcUrl = applicationContext.getBean("getJdbcUrl");
//        StudentService bean = applicationContext.getBean(StudentService.class);
//        JwtService bean1 = applicationContext.getBean(JwtService.class);
//        String s = bean1.generateToken("123");
//        bean1.parseToken(s);
//        UserService userService = applicationContext.getBean(UserService.class);
//        userService.addUserBatch();
        TestConfiguration bean2 = applicationContext.getBean(TestConfiguration.class);
        User user1 = applicationContext.getBean("user1", User.class);
        User user11 = bean2.getUser1();
//        JdbcUtil bean2 = applicationContext.getBean(JdbcUtil.class);
    }
}
