Avoid using immutable collections for configuration proprerties

Closes gh-8620
This commit is contained in:
Stephane Nicoll 2017-03-16 12:39:48 +01:00
parent ed2164b97b
commit cd76da9a4c
4 changed files with 21 additions and 17 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
@ -16,7 +16,8 @@
package org.springframework.boot.autoconfigure.elasticsearch.jest;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ -33,7 +34,8 @@ public class JestProperties {
/**
* Comma-separated list of the Elasticsearch instances to use.
*/
private List<String> uris = Arrays.asList("http://localhost:9200");
private List<String> uris = new ArrayList<String>(
Collections.singletonList("http://localhost:9200"));
/**
* Login user.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
@ -17,7 +17,6 @@
package org.springframework.boot.autoconfigure.flyway;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -40,7 +39,8 @@ public class FlywayProperties {
/**
* Locations of migrations scripts.
*/
private List<String> locations = new ArrayList<String>(Arrays.asList("db/migration"));
private List<String> locations = new ArrayList<String>(
Collections.singletonList("db/migration"));
/**
* Check that migration scripts location exists.
@ -72,7 +72,7 @@ public class FlywayProperties {
* SQL statements to execute to initialize a connection immediately after obtaining
* it.
*/
private List<String> initSqls = Collections.emptyList();
private List<String> initSqls = new ArrayList<String>();
public void setLocations(List<String> locations) {
this.locations = locations;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
@ -17,7 +17,7 @@
package org.springframework.boot.autoconfigure.security;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@ -314,7 +314,8 @@ public class SecurityProperties implements SecurityPrerequisite {
/**
* Granted roles for the default user name.
*/
private List<String> role = new ArrayList<String>(Arrays.asList("USER"));
private List<String> role = new ArrayList<String>(
Collections.singletonList("USER"));
private boolean defaultPassword = true;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
@ -16,6 +16,7 @@
package org.springframework.boot.jta.narayana;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -90,22 +91,22 @@ public class NarayanaProperties {
/**
* Comma-separated list of orphan filters.
*/
private List<String> xaResourceOrphanFilters = Arrays.asList(
private List<String> xaResourceOrphanFilters = new ArrayList<String>(Arrays.asList(
"com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResourceOrphanFilter",
"com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter");
"com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter"));
/**
* Comma-separated list of recovery modules.
*/
private List<String> recoveryModules = Arrays.asList(
private List<String> recoveryModules = new ArrayList<String>(Arrays.asList(
"com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule",
"com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule");
"com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule"));
/**
* Comma-separated list of expiry scanners.
*/
private List<String> expiryScanners = Collections.singletonList(
"com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner");
private List<String> expiryScanners = new ArrayList<String>(Collections.singletonList(
"com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner"));
public String getLogDir() {
return this.logDir;