Skip to content

Instantly share code, notes, and snippets.

@ihopeudie
Created October 8, 2018 10:44
Show Gist options
  • Save ihopeudie/9e2be861cdeca29fc94eba84ea531f21 to your computer and use it in GitHub Desktop.
Save ihopeudie/9e2be861cdeca29fc94eba84ea531f21 to your computer and use it in GitHub Desktop.
@Bean
public List<DiscountStrategy> strategyList() {
return Arrays.asList(birthDayStrategy(), tensTicketStrategy());
}
@Bean
public DiscountStrategy tensTicketStrategy() {
DiscountStrategy strategy = new DiscountStrategy();
strategy.setName("10th ticket Strategy");
strategy.setActive(true);
strategy.setBaseDiscount(50);
strategy.setDiscount(50);
strategy.setOption(10);
return strategy;
}
@Bean
public DiscountStrategy birthDayStrategy() {
DiscountStrategy strategy = new DiscountStrategy();
strategy.setName("Birthday Strategy");
strategy.setActive(true);
strategy.setDiscount(5);
strategy.setOption(5);
return strategy;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment