I've solved this as follows.
I've realised that there is a distinction between getting the property from the resource bundle and then setting the property on the bean - Spring will do the conversion while setting the property using the relevant PropertyEditor (ResourceEditor). So we have to do this step manually:
@Configuration
@PropertySource("classpath:my.properties")
public class TestConfig {
@Autowired Environment environment;
@Bean
public TestBean testBean() throws Exception {
ResourceEditor editor = new ResourceEditor();
editor.setAsText(environment.getProperty("myProps.value"));
TestBean testBean = new TestBean();
testBean.setSomeValue((Resource)editor.getValue());
return testBean;
}
}
However this does leave the outstanding question of why the DefaultConversionService used internally by the Environment will not pick up the PropertyEditor automatically. This could be to do with: