Is it possible to use Spring\'s @Value annotation to read and write property values of a custom class type?
For example:
@Component
@PropertySource(\
It's possible but reading Spring documentation. You could see this example: Example usage
@Configuration
@PropertySource("classpath:/com/myco/app.properties")
public class AppConfig {
@Autowired
Environment env;
@Bean
public TestBean testBean() {
TestBean testBean = new TestBean();
testBean.setName(env.getProperty("testbean.name"));
return testBean;
}
}
See details here