I am new using dependency injection. Can anyone tell me how to configure a servlet to inject a string URI pointing to a file? The method signature is the following:
@Inject
public void setCar(String value)
{
CarUri =value;
}
Thanks in advance!
You can try injecting @Named
fields
// inside module
@Provides
@Named("CarURI")
public String carURI() {
return "URI";
}
@Inject
public void setCar(@Named("CarURI") String value) {
CarUri = value;
}
example:
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments