Created
October 8, 2018 10:44
-
-
Save ihopeudie/9e2be861cdeca29fc94eba84ea531f21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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