Home > Software engineering >  How to set server name, login and password to application.properties? [closed]
How to set server name, login and password to application.properties? [closed]

Time:09-21

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;
}

Spring

  • Related