I am doing FTP-client in Spring boot (Java), i want to keep server name, login, password in application.properties to easy switching server.
How i can do it?
CodePudding user response:
Define the key-value in your Springboot configuration file, just write a configuration class and automatically inject it where you need to use it.
@Data
@ConfigurationProperties("auth")
@Component
public class AuthProperties {
private boolean enable;
private List<String> anon;
}
