Move to constructor injection in simple configuration classes

This commit updates "simple" configuration classes to use constructor
injection. Simple means that there are no optional dependencies
(@Autowired(required=false) is not used), and none of the dependencies
use generics.

Configuration classes that are not simple will be updated in a second
pass once https://jira.spring.io/browse/SPR-14015 has been fixed.

See gh-5306
This commit is contained in:
Andy Wilkinson
2016-03-04 10:49:17 +00:00
parent 398aed7fdb
commit 5009933788
74 changed files with 525 additions and 321 deletions

View File

@@ -28,7 +28,6 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.devtools.filewatch.ChangedFile;
import org.springframework.boot.devtools.filewatch.FileSystemWatcher;
import org.springframework.boot.devtools.filewatch.FileSystemWatcherFactory;
@@ -92,8 +91,11 @@ public class ClassPathFileSystemWatcherTests {
@Configuration
public static class Config {
@Autowired
public Environment environment;
public final Environment environment;
public Config(Environment environment) {
this.environment = environment;
}
@Bean
public ClassPathFileSystemWatcher watcher() {