@Configuration
@EnableConfigurationProperties({FileProperties.class})
public class FileAutoConfiguration {
@Autowired
private FileProperties fileProperties;
public FilService filService(){
return new FilService(fileProperties);
}
}
domian
FileProperties
@Setter
@Getter
@ConfigurationProperties(prefix = "file")
public class FileProperties {
private String path;
private String domain;
private boolean enable;
}
config:FileAutoConfiguration类@Configuration@EnableConfigurationProperties({FileProperties.class})public class FileAutoConfiguration { @Autowired private FileProperties fileProperties; public FilService filService(){ return new