|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2016 the original author or authors. |
| 2 | + * Copyright 2002-2018 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
42 | 42 | * @Configuration
|
43 | 43 | * @PropertySource("classpath:/com/myco/app.properties")
|
44 | 44 | * public class AppConfig {
|
| 45 | + * |
45 | 46 | * @Autowired
|
46 | 47 | * Environment env;
|
47 | 48 | *
|
|
53 | 54 | * }
|
54 | 55 | * }</pre>
|
55 | 56 | *
|
56 |
| - * Notice that the {@code Environment} object is @{@link |
57 |
| - * org.springframework.beans.factory.annotation.Autowired Autowired} into the |
| 57 | + * Notice that the {@code Environment} object is |
| 58 | + * {@link org.springframework.beans.factory.annotation.Autowired @Autowired} into the |
58 | 59 | * configuration class and then used when populating the {@code TestBean} object. Given
|
59 | 60 | * the configuration above, a call to {@code testBean.getName()} will return "myTestBean".
|
60 | 61 | *
|
|
79 | 80 | * @Configuration
|
80 | 81 | * @PropertySource("classpath:/com/${my.placeholder:default/path}/app.properties")
|
81 | 82 | * public class AppConfig {
|
| 83 | + * |
82 | 84 | * @Autowired
|
83 | 85 | * Environment env;
|
84 | 86 | *
|
|
118 | 120 | *
|
119 | 121 | * The override ordering depends on the order in which these classes are registered
|
120 | 122 | * with the application context.
|
| 123 | + * |
121 | 124 | * <pre class="code">
|
122 |
| - * AnnotationConfigApplicationContext ctx = |
123 |
| - * new AnnotationConfigApplicationContext(); |
| 125 | + * AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); |
124 | 126 | * ctx.register(ConfigA.class);
|
125 | 127 | * ctx.register(ConfigB.class);
|
126 | 128 | * ctx.refresh();
|
|
139 | 141 | * and {@link org.springframework.core.env.MutablePropertySources MutablePropertySources}
|
140 | 142 | * javadocs for details.
|
141 | 143 | *
|
| 144 | + * <p><b>NOTE: This annotation is repeatable according to Java 8 conventions.</b> |
| 145 | + * However, all such {@code @PropertySource} annotations need to be declared at the same |
| 146 | + * level: either directly on the configuration class or as meta-annotations within the |
| 147 | + * same custom annotation. Mixing of direct annotations and meta-annotations is not |
| 148 | + * recommended since direct annotations will effectively override meta-annotations. |
| 149 | + * |
142 | 150 | * @author Chris Beams
|
143 | 151 | * @author Juergen Hoeller
|
144 | 152 | * @author Phillip Webb
|
|
0 commit comments