I have a configuration parameter "myconfig.defaultSize" whose value is defined, for example, as "10MB", in the application.properties file.
In the other hand, I have a @Component class with @ConfigurationProperties annotation mapping those configuration parameter, as follows.
@Component
@ConfigurationProperties(prefix="myconfig")
public class StorageServiceProperties {
private Long defaultSize;
//...getters and setters
}
So, how can I would apply a method to convert the String value into Long?