spring boot reads the configuration file

@Component
@PropertySource("classpath:url.properties")
@ConfigurationProperties(prefix = "vhall")
public class VhallUrl {

    private String userName;
	
    private String password;

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

    //Notice! Configure a Bean of PropertySourcesPlaceholderConfigurer
//    @Bean
//    public static PropertySourcesPlaceholderConfigurer propertyConfigure() {
//        return new PropertySourcesPlaceholderConfigurer();
//    }
	
}

  Reference: http://blog.csdn.net/flygoa/article/details/58075398

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326644596&siteId=291194637