Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
f6380ba6
Commit
f6380ba6
authored
Feb 10, 2019
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15837 from kedar-joshi
* pr/15837: Polish
parents
6e5ffd85
4a253ff8
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
27 additions
and
36 deletions
+27
-36
EntityScanPackages.java
...amework/boot/autoconfigure/domain/EntityScanPackages.java
+2
-3
SpringApplication.java
...main/java/org/springframework/boot/SpringApplication.java
+2
-4
SpringIterableConfigurationPropertySource.java
...ies/source/SpringIterableConfigurationPropertySource.java
+1
-4
ServletComponentScanRegistrar.java
...ework/boot/web/servlet/ServletComponentScanRegistrar.java
+2
-3
ServletContextInitializerBeans.java
...work/boot/web/servlet/ServletContextInitializerBeans.java
+2
-3
SpringApplicationTests.java
...java/org/springframework/boot/SpringApplicationTests.java
+2
-3
ConfigurationsTests.java
...ramework/boot/context/annotation/ConfigurationsTests.java
+4
-2
ConfigFileApplicationListenerTests.java
...ot/context/config/ConfigFileApplicationListenerTests.java
+3
-4
JettyServletWebServerFactoryTests.java
...web/embedded/jetty/JettyServletWebServerFactoryTests.java
+2
-1
MimeMappingsTests.java
...rg/springframework/boot/web/server/MimeMappingsTests.java
+2
-3
AbstractFilterRegistrationBeanTests.java
...boot/web/servlet/AbstractFilterRegistrationBeanTests.java
+2
-2
SpringBootServletInitializerTests.java
...eb/servlet/support/SpringBootServletInitializerTests.java
+3
-4
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/domain/EntityScanPackages.java
View file @
f6380ba6
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -155,8 +155,7 @@ public class EntityScanPackages {
String
[]
basePackages
=
attributes
.
getStringArray
(
"basePackages"
);
Class
<?>[]
basePackageClasses
=
attributes
.
getClassArray
(
"basePackageClasses"
);
Set
<
String
>
packagesToScan
=
new
LinkedHashSet
<>();
packagesToScan
.
addAll
(
Arrays
.
asList
(
basePackages
));
Set
<
String
>
packagesToScan
=
new
LinkedHashSet
<>(
Arrays
.
asList
(
basePackages
));
for
(
Class
<?>
basePackageClass
:
basePackageClasses
)
{
packagesToScan
.
add
(
ClassUtils
.
getPackageName
(
basePackageClass
));
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java
View file @
f6380ba6
...
...
@@ -1185,8 +1185,7 @@ public class SpringApplication {
*/
public
void
setInitializers
(
Collection
<?
extends
ApplicationContextInitializer
<?>>
initializers
)
{
this
.
initializers
=
new
ArrayList
<>();
this
.
initializers
.
addAll
(
initializers
);
this
.
initializers
=
new
ArrayList
<>(
initializers
);
}
/**
...
...
@@ -1213,8 +1212,7 @@ public class SpringApplication {
* @param listeners the listeners to set
*/
public
void
setListeners
(
Collection
<?
extends
ApplicationListener
<?>>
listeners
)
{
this
.
listeners
=
new
ArrayList
<>();
this
.
listeners
.
addAll
(
listeners
);
this
.
listeners
=
new
ArrayList
<>(
listeners
);
}
/**
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java
View file @
f6380ba6
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -132,9 +132,6 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope
private
Cache
getCache
()
{
CacheKey
cacheKey
=
CacheKey
.
get
(
getPropertySource
());
if
(
cacheKey
==
null
)
{
return
null
;
}
if
(
ObjectUtils
.
nullSafeEquals
(
cacheKey
,
this
.
cacheKey
))
{
return
this
.
cache
;
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrar.java
View file @
f6380ba6
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -77,8 +77,7 @@ class ServletComponentScanRegistrar implements ImportBeanDefinitionRegistrar {
metadata
.
getAnnotationAttributes
(
ServletComponentScan
.
class
.
getName
()));
String
[]
basePackages
=
attributes
.
getStringArray
(
"basePackages"
);
Class
<?>[]
basePackageClasses
=
attributes
.
getClassArray
(
"basePackageClasses"
);
Set
<
String
>
packagesToScan
=
new
LinkedHashSet
<>();
packagesToScan
.
addAll
(
Arrays
.
asList
(
basePackages
));
Set
<
String
>
packagesToScan
=
new
LinkedHashSet
<>(
Arrays
.
asList
(
basePackages
));
for
(
Class
<?>
basePackageClass
:
basePackageClasses
)
{
packagesToScan
.
add
(
ClassUtils
.
getPackageName
(
basePackageClass
));
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java
View file @
f6380ba6
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -238,8 +238,7 @@ public class ServletContextInitializerBeans
}
}
}
List
<
Entry
<
String
,
T
>>
beans
=
new
ArrayList
<>();
beans
.
addAll
(
map
.
entrySet
());
List
<
Entry
<
String
,
T
>>
beans
=
new
ArrayList
<>(
map
.
entrySet
());
beans
.
sort
((
o1
,
o2
)
->
AnnotationAwareOrderComparator
.
INSTANCE
.
compare
(
o1
.
getValue
(),
o2
.
getValue
()));
return
beans
;
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java
View file @
f6380ba6
...
...
@@ -16,7 +16,6 @@
package
org
.
springframework
.
boot
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.Iterator
;
...
...
@@ -347,7 +346,7 @@ public class SpringApplicationTests {
SpringApplication
application
=
new
SpringApplication
(
ExampleConfig
.
class
);
application
.
setWebApplicationType
(
WebApplicationType
.
NONE
);
final
AtomicReference
<
ApplicationContext
>
reference
=
new
AtomicReference
<>();
application
.
setInitializers
(
Arrays
.
as
List
(
application
.
setInitializers
(
Collections
.
singleton
List
(
(
ApplicationContextInitializer
<
ConfigurableApplicationContext
>)
reference:
:
set
));
this
.
context
=
application
.
run
(
"--foo=bar"
);
assertThat
(
this
.
context
).
isSameAs
(
reference
.
get
());
...
...
@@ -387,7 +386,7 @@ public class SpringApplicationTests {
}
}
application
.
setListeners
(
Arrays
.
as
List
(
new
InitializerListener
()));
application
.
setListeners
(
Collections
.
singleton
List
(
new
InitializerListener
()));
this
.
context
=
application
.
run
(
"--foo=bar"
);
assertThat
(
this
.
context
).
isSameAs
(
reference
.
get
());
// Custom initializers do not switch off the defaults
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/annotation/ConfigurationsTests.java
View file @
f6380ba6
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -21,6 +21,7 @@ import java.io.OutputStream;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Set
;
...
...
@@ -59,7 +60,8 @@ public class ConfigurationsTests {
public
void
getClassesShouldMergeByClassAndSort
()
{
Configurations
c1
=
new
TestSortedConfigurations
(
Arrays
.
asList
(
OutputStream
.
class
,
InputStream
.
class
));
Configurations
c2
=
new
TestConfigurations
(
Arrays
.
asList
(
Short
.
class
));
Configurations
c2
=
new
TestConfigurations
(
Collections
.
singletonList
(
Short
.
class
));
Configurations
c3
=
new
TestSortedConfigurations
(
Arrays
.
asList
(
String
.
class
,
Integer
.
class
));
Configurations
c4
=
new
TestConfigurations
(
Arrays
.
asList
(
Long
.
class
,
Byte
.
class
));
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java
View file @
f6380ba6
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -20,7 +20,6 @@ import java.io.File;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -1054,8 +1053,8 @@ public class ConfigFileApplicationListenerTests {
@Override
List
<
EnvironmentPostProcessor
>
loadPostProcessors
()
{
return
new
ArrayList
<>(
Arrays
.
as
List
(
new
LowestPrecedenceEnvironmentPostProcessor
()));
return
new
ArrayList
<>(
Collections
.
singleton
List
(
new
LowestPrecedenceEnvironmentPostProcessor
()));
}
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java
View file @
f6380ba6
...
...
@@ -21,6 +21,7 @@ import java.nio.charset.Charset;
import
java.time.Duration
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Locale
;
import
java.util.Map
;
...
...
@@ -209,7 +210,7 @@ public class JettyServletWebServerFactoryTests
@Test
public
void
wrappedHandlers
()
throws
Exception
{
JettyServletWebServerFactory
factory
=
getFactory
();
factory
.
setServerCustomizers
(
Arrays
.
as
List
((
server
)
->
{
factory
.
setServerCustomizers
(
Collections
.
singleton
List
((
server
)
->
{
Handler
handler
=
server
.
getHandler
();
HandlerWrapper
wrapper
=
new
HandlerWrapper
();
wrapper
.
setHandler
(
handler
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/MimeMappingsTests.java
View file @
f6380ba6
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -77,8 +77,7 @@ public class MimeMappingsTests {
MimeMappings
mappings
=
new
MimeMappings
();
mappings
.
add
(
"foo"
,
"bar"
);
mappings
.
add
(
"baz"
,
"boo"
);
List
<
MimeMappings
.
Mapping
>
mappingList
=
new
ArrayList
<>();
mappingList
.
addAll
(
mappings
.
getAll
());
List
<
MimeMappings
.
Mapping
>
mappingList
=
new
ArrayList
<>(
mappings
.
getAll
());
assertThat
(
mappingList
.
get
(
0
).
getExtension
()).
isEqualTo
(
"foo"
);
assertThat
(
mappingList
.
get
(
0
).
getMimeType
()).
isEqualTo
(
"bar"
);
assertThat
(
mappingList
.
get
(
1
).
getExtension
()).
isEqualTo
(
"baz"
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java
View file @
f6380ba6
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -144,7 +144,7 @@ public abstract class AbstractFilterRegistrationBeanTests {
AbstractFilterRegistrationBean
<?>
bean
=
createFilterRegistrationBean
(
mockServletRegistration
(
"a"
));
bean
.
setServletRegistrationBeans
(
new
LinkedHashSet
<
ServletRegistrationBean
<?>>(
Arrays
.
as
List
(
mockServletRegistration
(
"b"
))));
Collections
.
singleton
List
(
mockServletRegistration
(
"b"
))));
bean
.
onStartup
(
this
.
servletContext
);
verify
(
this
.
registration
).
addMappingForServletNames
(
EnumSet
.
of
(
DispatcherType
.
REQUEST
),
false
,
"b"
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java
View file @
f6380ba6
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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,6 @@
package
org
.
springframework
.
boot
.
web
.
servlet
.
support
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
javax.servlet.ServletContext
;
...
...
@@ -135,8 +134,8 @@ public class SpringBootServletInitializerTests {
@Test
public
void
servletContextPropertySourceIsAvailablePriorToRefresh
()
{
ServletContext
servletContext
=
mock
(
ServletContext
.
class
);
given
(
servletContext
.
getInitParameterNames
()).
willReturn
(
Collections
.
enumeration
(
Arrays
.
as
List
(
"spring.profiles.active"
)));
given
(
servletContext
.
getInitParameterNames
()).
willReturn
(
Collections
.
enumeration
(
Collections
.
singleton
List
(
"spring.profiles.active"
)));
given
(
servletContext
.
getInitParameter
(
"spring.profiles.active"
))
.
willReturn
(
"from-servlet-context"
);
given
(
servletContext
.
getAttributeNames
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment