17 lines
530 B
Java
17 lines
530 B
Java
package com.baeldung.configurationproperties;
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationPropertiesBinding;
|
|
import org.springframework.core.convert.converter.Converter;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
@Component
|
|
@ConfigurationPropertiesBinding
|
|
public class EmployeeConverter implements Converter<String, Employee> {
|
|
|
|
@Override
|
|
public Employee convert(String from) {
|
|
String[] data = from.split(",");
|
|
return new Employee(data[0], Double.parseDouble(data[1]));
|
|
}
|
|
}
|