import com.example.service.SpeakerService;
import com.example.service.SpeakerServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Application {
    public static void main(String[] args) {
        //Loads config into application
        //Injects speaker repo bean into speaker service bean
        ApplicationContext appContext = new AnnotationConfigApplicationContext(AppConfig.class);

//        SpeakerService service = new SpeakerServiceImpl();


        SpeakerService service = appContext.getBean("speakerService", SpeakerService.class);
//        System.out.println(service);

        System.out.println(service.findALl().get(0).getFirstName());
        System.out.println(service.findALl().get(0).getSeedNum());

        // Returns same bean as service --> Singleton
        // With scope Prototype, returns two different instances of each bean --> Prototype
//        SpeakerService service2 = appContext.getBean("speakerService", SpeakerService.class);
//        System.out.println(service2);
    }
}