java/Spring Inject a property value in pojo (non-managed) -
i have pojo class in fields annotated custom annotation. non-spring managed class.
public class reportheader { @field(position = 1) private string jobname; .... }
now want pass value of "position" attribute in annotation through property file, below:
public class reportheader { @field(position = "${read.my.position}") private string jobname; .... }
how can in pojo class or without spring?
if it's not managed spring, cannot expect inject anything. it's either/or proposition.
you can have spring manage .properties , give reportheader
constructor set state using properties
object that's passed in.
Comments
Post a Comment