Skip to content

Commit

Permalink
Clarify the semantic of lite mode
Browse files Browse the repository at this point in the history
This commit removes the "plain old class" bit of the documentation as
it may be confusing. The gist of it is that it must be a bean but not
annotated with `@Configuration` so the updated sentence states exactly
that.

Closes gh-29957
  • Loading branch information
snicoll committed Oct 24, 2023
1 parent 54839a7 commit 322013a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The preceding `AppConfig` class is equivalent to the following Spring `<beans/>`
****
When `@Bean` methods are declared within classes that are not annotated with
`@Configuration`, they are referred to as being processed in a "`lite`" mode. Bean methods
declared in a `@Component` or even in a plain old class are considered to be "`lite`",
declared on a bean that is not annotated with `@Configuration` are considered to be "`lite`",
with a different primary purpose of the containing class and a `@Bean` method
being a sort of bonus there. For example, service components may expose management views
to the container through an additional `@Bean` method on each applicable component class.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -135,9 +135,9 @@
* <h3>{@code @Bean} <em>Lite</em> Mode</h3>
*
* <p>{@code @Bean} methods may also be declared within classes that are <em>not</em>
* annotated with {@code @Configuration}. For example, bean methods may be declared
* in a {@code @Component} class or even in a <em>plain old class</em>. In such cases,
* a {@code @Bean} method will get processed in a so-called <em>'lite'</em> mode.
* annotated with {@code @Configuration}. If a bean methods is declared on a bean
* that is <em>not</em> annotated with {@code @Configuration} it is processed in a
* so-called <em>'lite'</em> mode.
*
* <p>Bean methods in <em>lite</em> mode will be treated as plain <em>factory
* methods</em> by the container (similar to {@code factory-method} declarations
Expand Down

0 comments on commit 322013a

Please sign in to comment.