import com.Config.JdbcUtil;
import com.Config.SpringConfiguration;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidPooledConnection;
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();
        System.out.println(JdbcUtil.URL);
//        JdbcUtil bean2 = applicationContext.getBean(JdbcUtil.class);
    }
}
