public class Player {
@Autowired gameService
@Getter @Setter String name;
public Player(String name) {
this.name = name
}
public doSomething() {
gameService.something() // gameService is null!
}
}
@Service
class GameService { public void something() {...} }
If I were to do new Player("John").doSomething()
java complains that this.gameService is null. Player class is needed to be instantiated.
Is it possible to make gameService autowire to the service correctly?