[BAEL-15990] - Moved properties articles
This commit is contained in:
@@ -11,7 +11,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
|
||||
### Relevant articles:
|
||||
|
||||
- [Guide to Spring @Autowired](http://www.baeldung.com/spring-autowire)
|
||||
- [Properties with Spring and Spring Boot](http://www.baeldung.com/properties-with-spring) - checkout the `org.baeldung.properties` package for all scenarios of properties injection and usage
|
||||
- [Spring Profiles](http://www.baeldung.com/spring-profiles)
|
||||
- [A Spring Custom Annotation for a Better DAO](http://www.baeldung.com/spring-annotation-bean-pre-processor)
|
||||
- [What’s New in Spring 4.3?](http://www.baeldung.com/whats-new-in-spring-4-3)
|
||||
|
||||
@@ -1,2 +1,10 @@
|
||||
### Relevant Articles:
|
||||
- [Reloading Properties in Spring](https://www.baeldung.com/reloading-properties-files-in-spring/)
|
||||
- [Reloading Properties in Spring](https://www.baeldung.com/reloading-properties-files-in-spring/)
|
||||
- [Guide to @ConfigurationProperties in Spring Boot](http://www.baeldung.com/configuration-properties-in-spring-boot)
|
||||
- [Load Spring Boot Properties From a JSON File](https://www.baeldung.com/spring-boot-json-properties)
|
||||
- [Guide to @EnableConfigurationProperties](https://www.baeldung.com/spring-enable-config-properties)
|
||||
- [Properties with Spring and Spring Boot](http://www.baeldung.com/properties-with-spring) - checkout the `org.baeldung.properties` package for all scenarios of properties injection and usage
|
||||
- [A Quick Guide to Spring @Value](http://www.baeldung.com/spring-value-annotation)
|
||||
- [Spring YAML Configuration](http://www.baeldung.com/spring-yaml)
|
||||
- [Using Spring @Value with Defaults](http://www.baeldung.com/spring-value-defaults)
|
||||
- [How to Inject a Property Value Into a Class Not Managed by Spring?](http://www.baeldung.com/inject-properties-value-non-spring-class)
|
||||
@@ -37,6 +37,16 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${guava.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>${httpcore.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
@@ -99,6 +109,8 @@
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud.version>Greenwich.SR1</spring-cloud.version>
|
||||
<commons-configuration.version>1.10</commons-configuration.version>
|
||||
<guava.version>20.0</guava.version>
|
||||
<httpcore.version>4.4.11</httpcore.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.properties;
|
||||
package com.baeldung.properties;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
+3
-1
@@ -1,7 +1,9 @@
|
||||
package org.baeldung.properties;
|
||||
package com.baeldung.properties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "additional")
|
||||
public class AdditionalProperties {
|
||||
|
||||
+12
-5
@@ -10,6 +10,7 @@ import javax.validation.constraints.Pattern;
|
||||
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -54,7 +55,7 @@ public class ConfigProperties {
|
||||
}
|
||||
|
||||
@NotBlank
|
||||
private String host;
|
||||
private String hostName;
|
||||
|
||||
@Min(1025)
|
||||
@Max(65536)
|
||||
@@ -67,12 +68,12 @@ public class ConfigProperties {
|
||||
private List<String> defaultRecipients;
|
||||
private Map<String, String> additionalHeaders;
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
public String getHostName() {
|
||||
return hostName;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
public void setHostName(String hostName) {
|
||||
this.hostName = hostName;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
@@ -114,4 +115,10 @@ public class ConfigProperties {
|
||||
public void setAdditionalHeaders(Map<String, String> additionalHeaders) {
|
||||
this.additionalHeaders = additionalHeaders;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "item")
|
||||
public Item item(){
|
||||
return new Item();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.properties;
|
||||
package com.baeldung.properties;
|
||||
|
||||
public class Item {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user