Polish doc code samples

See gh-6313
This commit is contained in:
Phillip Webb
2021-05-03 21:16:45 -07:00
parent 9aad29da0c
commit b5583a4620
165 changed files with 517 additions and 482 deletions

View File

@@ -10,14 +10,14 @@ The following example shows a `@Service` Bean that uses constructor injection to
[source,java,indent=0]
----
include::{docs-java}/using/springbeansanddependencyinjection/singleconstructor/DatabaseAccountService.java[]
include::{docs-java}/using/springbeansanddependencyinjection/singleconstructor/MyAccountService.java[]
----
If a bean has more than one constructor, you'll need to mark the one you want Spring to use with `@Autowired`:
[source,java,indent=0]
----
include::{docs-java}/using/springbeansanddependencyinjection/multipleconstructors/DatabaseAccountService.java[]
include::{docs-java}/using/springbeansanddependencyinjection/multipleconstructors/MyAccountService.java[]
----
TIP: Notice how using constructor injection lets the `riskAssessor` field be marked as `final`, indicating that it cannot be subsequently changed.