You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
David Zemon edited this page Feb 6, 2017
·
2 revisions
Migration to Java Config
The purpose of this lab is to teach you how to use Spring's Java Configuration. One bean has already been converted for
you. Convert the remaining beans to Java Config and delete the XML.
Instructions
Add the beans listed below to MainConfig.java.
scanner
randomNumberGenerator
pokemonDao
pokemonLocationDao
pokemonFactory
gameBoard
This bean requires a size to be imported from our properties file.
Use @Value("${default-map-size}") final int size as a parameter to the gameBoard() method
Import properties by adding @PropertySource("...") where the argument to the annotation is the path to your
properties file. Note that, in the case of multiple properties file, an array of Strings can be used.
Remove the XML configuration file its reference
Remove the @ImportResource("classpath:spring-context.xml")
Delete the XML file.
Test your application
Run MainConfig.java and fix any issues that might come up.