use of ru.javawebinar.topjava.to.MealWithExceed in project topjava10 by JavaWebinar.
the class SpringMain method main.
public static void main(String[] args) {
// java 7 Automatic resource management
try (GenericXmlApplicationContext appCtx = new GenericXmlApplicationContext()) {
appCtx.getEnvironment().setActiveProfiles(Profiles.getActiveDbProfile(), Profiles.REPOSITORY_IMPLEMENTATION);
appCtx.load("spring/spring-app.xml", "spring/mock.xml");
appCtx.refresh();
mockAuthorize(USER);
System.out.println("Bean definition names: " + Arrays.toString(appCtx.getBeanDefinitionNames()));
AdminRestController adminUserController = appCtx.getBean(AdminRestController.class);
adminUserController.create(new User(null, "userName", "email", "password", 1500, Role.ROLE_ADMIN));
System.out.println();
MealRestController mealController = appCtx.getBean(MealRestController.class);
List<MealWithExceed> filteredMealsWithExceeded = mealController.getBetween(LocalDate.of(2015, Month.MAY, 30), LocalTime.of(7, 0), LocalDate.of(2015, Month.MAY, 31), LocalTime.of(11, 0));
filteredMealsWithExceeded.forEach(System.out::println);
}
}
Aggregations