@Component
public class MyBean {

    @Value("${name}")
    private String name;

    // ...

}