Skip to content

Commit 9b221f5

Browse files
committed
Document further configuration class restrictions
Issue: SPR-14602 (cherry picked from commit 6fe7e56)
1 parent f7c3b81 commit 9b221f5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

spring-context/src/main/java/org/springframework/context/annotation/Configuration.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -357,9 +357,14 @@
357357
* <h2>Constraints when authoring {@code @Configuration} classes</h2>
358358
*
359359
* <ul>
360-
* <li>&#064;Configuration classes must be non-final
361-
* <li>&#064;Configuration classes must be non-local (may not be declared within a method)
362-
* <li>Any nested configuration classes must be {@code static}.
360+
* <li>Configuration classes must be provided as classes (i.e. not as instances returned
361+
* from factory methods), allowing for runtime enhancements through a generated subclass.
362+
* <li>Configuration classes must be non-final.
363+
* <li>Configuration classes must be non-local (i.e. may not be declared within a method).
364+
* <li>Any nested configuration classes must be declared as {@code static}.
365+
* <li>{@code @Bean} methods may not in turn create further configuration classes
366+
* (any such instances will be treated as regular beans, with their configuration
367+
* annotations remaining undetected).
363368
* </ul>
364369
*
365370
* @author Rod Johnson

0 commit comments

Comments
 (0)