Skip to content

Instantly share code, notes, and snippets.

@rbaul
Last active January 3, 2019 13:02
Show Gist options
  • Save rbaul/e99c8eaebd44fba0abc8a13c761e27ec to your computer and use it in GitHub Desktop.
Save rbaul/e99c8eaebd44fba0abc8a13c761e27ec to your computer and use it in GitHub Desktop.
Custom Configuration Properties
documentation:
baseurl: newlocalhost
swagger:
services:
-
name: My Service
url: ${documentation.baseurl}/....
version: 2.0
-
name: My Service
url: ${documentation.baseurl}/....
version: 2.0
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import java.util.List;
@Getter
@Setter
@EnableConfigurationProperties
@ConfigurationProperties(prefix = "documentation.swagger")
public class SwaggerServicesConfig {
private String baseurl = "localhost";
private List<SwaggerServices> services;
@Getter
@Setter
@ToString
@EnableConfigurationProperties
public static class SwaggerServices {
private String name;
private String url;
private String version;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment