I can't inject the service using the @Autowired in the jsf converter:
Converter:
@Component("advertiserConverter")
@FacesConverter("advertiserConverter")
public class AdvertiserConverter implements Converter , Serializable {
@Autowired
private IAdvertiserService advertiserService;
public Object getAsObject(FacesContext context, UIComponent component, String value) {
if (value == null || value.length() == 0) {
return null;
}
Long id = Long.parseLong(value);
return advertiserService.findAdvertiser(id);
}
public String getAsString(FacesContext context, UIComponent component, Object value) {
return value instanceof Advertiser ? ((Advertiser) value).getId().toString() : "";
}
}
ApplicationContext.xml:
<context:annotation-config />
<context:component-scan base-package="com.test.example"/>
<tx:annotation-driven />
Service:
@Service
@Transactional
public class AdvertiserServiceImpl implements IAdvertiserService {
}