I am trying to use spring injection to inject into an enum. Like this:
public enum Car {
HONDA("Honda", "hondas") {
@Inject
Carparts carparts;
@Override
public List<Carpart> getCarparts() {
return carparts.getCarpartsListings();
}
};
//more logic here
}
My Carparts bean is defined as follows in the configuration class:
@Bean
@Singleton
public Carparts geCarparts() {
return new Carparts();
}
But no matter what I get a null value for carparts injection. Any help will be greatly appreciated.