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
a085541d
Commit
a085541d
authored
Aug 28, 2018
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
bd482d70
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
81 additions
and
75 deletions
+81
-75
BeanTypeRegistry.java
...mework/boot/autoconfigure/condition/BeanTypeRegistry.java
+44
-41
ConditionalOnBeanTests.java
.../boot/autoconfigure/condition/ConditionalOnBeanTests.java
+0
-1
RestartClassLoaderTests.java
...devtools/restart/classloader/RestartClassLoaderTests.java
+2
-2
ZipInflaterInputStream.java
...ringframework/boot/loader/jar/ZipInflaterInputStream.java
+3
-6
UndertowEmbeddedServletContainerFactory.java
...ded/undertow/UndertowEmbeddedServletContainerFactory.java
+2
-2
NoSuchMethodFailureAnalyzer.java
...oot/diagnostics/analyzer/NoSuchMethodFailureAnalyzer.java
+24
-18
SpringBootServletInitializer.java
...mework/boot/web/support/SpringBootServletInitializer.java
+0
-1
JettyEmbeddedServletContainerFactoryTests.java
...dded/jetty/JettyEmbeddedServletContainerFactoryTests.java
+3
-3
NoSuchMethodFailureAnalyzerTests.java
...iagnostics/analyzer/NoSuchMethodFailureAnalyzerTests.java
+3
-1
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java
View file @
a085541d
...
...
@@ -149,6 +149,40 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
this
.
beanDefinitions
.
clear
();
}
private
RootBeanDefinition
getBeanDefinition
(
String
name
)
{
try
{
return
(
RootBeanDefinition
)
this
.
beanFactory
.
getMergedBeanDefinition
(
name
);
}
catch
(
BeanDefinitionStoreException
ex
)
{
logIgnoredError
(
"unresolvable metadata in bean definition"
,
name
,
ex
);
return
null
;
}
}
private
void
logIgnoredError
(
String
message
,
String
name
,
Exception
ex
)
{
if
(
BeanTypeRegistry
.
logger
.
isDebugEnabled
())
{
BeanTypeRegistry
.
logger
.
debug
(
"Ignoring "
+
message
+
" '"
+
name
+
"'"
,
ex
);
}
}
private
boolean
requiresEagerInit
(
String
factoryBeanName
)
{
return
(
factoryBeanName
!=
null
&&
this
.
beanFactory
.
isFactoryBean
(
factoryBeanName
)
&&
!
this
.
beanFactory
.
containsSingleton
(
factoryBeanName
));
}
private
void
updateTypesIfNecessary
()
{
Iterator
<
String
>
names
=
this
.
beanFactory
.
getBeanNamesIterator
();
while
(
names
.
hasNext
())
{
String
name
=
names
.
next
();
if
(!
this
.
beanTypes
.
containsKey
(
name
))
{
addBeanType
(
name
);
}
else
{
updateBeanType
(
name
);
}
}
}
private
void
addBeanType
(
String
name
)
{
if
(
this
.
beanFactory
.
containsSingleton
(
name
))
{
this
.
beanTypes
.
put
(
name
,
this
.
beanFactory
.
getType
(
name
));
...
...
@@ -165,13 +199,17 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
}
}
private
RootBeanDefinition
getBeanDefinition
(
String
name
)
{
try
{
return
(
RootBeanDefinition
)
this
.
beanFactory
.
getMergedBeanDefinition
(
name
)
;
private
void
updateBeanType
(
String
name
)
{
if
(
this
.
beanFactory
.
isAlias
(
name
)
||
this
.
beanFactory
.
containsSingleton
(
name
))
{
return
;
}
catch
(
BeanDefinitionStoreException
ex
)
{
logIgnoredError
(
"unresolvable metadata in bean definition"
,
name
,
ex
);
return
null
;
RootBeanDefinition
beanDefinition
=
getBeanDefinition
(
name
);
if
(
beanDefinition
==
null
)
{
return
;
}
RootBeanDefinition
previous
=
this
.
beanDefinitions
.
put
(
name
,
beanDefinition
);
if
(
previous
!=
null
&&
!
beanDefinition
.
equals
(
previous
))
{
addBeanTypeForNonAliasDefinition
(
name
,
beanDefinition
);
}
}
...
...
@@ -200,41 +238,6 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
}
}
private
void
logIgnoredError
(
String
message
,
String
name
,
Exception
ex
)
{
if
(
BeanTypeRegistry
.
logger
.
isDebugEnabled
())
{
BeanTypeRegistry
.
logger
.
debug
(
"Ignoring "
+
message
+
" '"
+
name
+
"'"
,
ex
);
}
}
private
boolean
requiresEagerInit
(
String
factoryBeanName
)
{
return
(
factoryBeanName
!=
null
&&
this
.
beanFactory
.
isFactoryBean
(
factoryBeanName
)
&&
!
this
.
beanFactory
.
containsSingleton
(
factoryBeanName
));
}
private
void
updateTypesIfNecessary
()
{
Iterator
<
String
>
names
=
this
.
beanFactory
.
getBeanNamesIterator
();
while
(
names
.
hasNext
())
{
String
name
=
names
.
next
();
if
(!
this
.
beanTypes
.
containsKey
(
name
))
{
addBeanType
(
name
);
}
else
{
if
(!
this
.
beanFactory
.
isAlias
(
name
)
&&
!
this
.
beanFactory
.
containsSingleton
(
name
))
{
RootBeanDefinition
beanDefinition
=
getBeanDefinition
(
name
);
if
(
beanDefinition
!=
null
)
{
RootBeanDefinition
existingDefinition
=
this
.
beanDefinitions
.
put
(
name
,
beanDefinition
);
if
(
existingDefinition
!=
null
&&
!
beanDefinition
.
equals
(
existingDefinition
))
{
addBeanTypeForNonAliasDefinition
(
name
,
beanDefinition
);
}
}
}
}
}
}
/**
* Attempt to guess the type that a {@link FactoryBean} will return based on the
* generics in its method signature.
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBeanTests.java
View file @
a085541d
...
...
@@ -347,7 +347,6 @@ public class ConditionalOnBeanTests {
public
static
class
ConsumingConfiguration
{
ConsumingConfiguration
(
String
testBean
)
{
}
}
...
...
spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java
View file @
a085541d
...
...
@@ -214,8 +214,8 @@ public class RestartClassLoaderTests {
}
private
<
T
>
List
<
T
>
toList
(
Enumeration
<
T
>
enumeration
)
{
return
(
(
enumeration
!=
null
)
?
Collections
.
list
(
enumeration
)
:
Collections
.<
T
>
emptyList
()
)
;
return
(
enumeration
!=
null
)
?
Collections
.
list
(
enumeration
)
:
Collections
.<
T
>
emptyList
();
}
}
spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/ZipInflaterInputStream.java
View file @
a085541d
...
...
@@ -30,19 +30,16 @@ import java.util.zip.InflaterInputStream;
*/
class
ZipInflaterInputStream
extends
InflaterInputStream
{
private
final
Inflater
inflater
;
private
int
available
;
private
boolean
extraBytesWritten
;
private
int
available
;
ZipInflaterInputStream
(
InputStream
inputStream
,
int
size
)
{
this
(
inputStream
,
new
Inflater
(
true
),
size
);
}
private
ZipInflaterInputStream
(
InputStream
inputStream
,
Inflater
inflater
,
int
size
)
{
super
(
inputStream
,
inflater
,
getInflaterBufferSize
(
size
));
this
.
inflater
=
inflater
;
super
(
inputStream
,
new
Inflater
(
true
),
getInflaterBufferSize
(
size
));
this
.
available
=
size
;
}
...
...
@@ -66,7 +63,7 @@ class ZipInflaterInputStream extends InflaterInputStream {
@Override
public
void
close
()
throws
IOException
{
super
.
close
();
this
.
inf
later
.
end
();
this
.
inf
.
end
();
}
@Override
...
...
spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java
View file @
a085541d
...
...
@@ -450,8 +450,8 @@ public class UndertowEmbeddedServletContainerFactory
private
AccessLogHandler
createAccessLogHandler
(
HttpHandler
handler
,
AccessLogReceiver
accessLogReceiver
)
{
createAccessLogDirectoryIfNecessary
();
String
formatString
=
(
(
this
.
accessLogPattern
!=
null
)
?
this
.
accessLogPattern
:
"common"
)
;
String
formatString
=
(
this
.
accessLogPattern
!=
null
)
?
this
.
accessLogPattern
:
"common"
;
return
new
AccessLogHandler
(
handler
,
accessLogReceiver
,
formatString
,
Undertow
.
class
.
getClassLoader
());
}
...
...
spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/NoSuchMethodFailureAnalyzer.java
View file @
a085541d
...
...
@@ -48,24 +48,8 @@ class NoSuchMethodFailureAnalyzer extends AbstractFailureAnalyzer<NoSuchMethodEr
if
(
actual
==
null
)
{
return
null
;
}
StringWriter
description
=
new
StringWriter
();
PrintWriter
writer
=
new
PrintWriter
(
description
);
writer
.
print
(
"An attempt was made to call the method "
);
writer
.
print
(
cause
.
getMessage
());
writer
.
print
(
" but it does not exist. Its class, "
);
writer
.
print
(
className
);
writer
.
println
(
", is available from the following locations:"
);
writer
.
println
();
for
(
URL
candidate
:
candidates
)
{
writer
.
print
(
" "
);
writer
.
println
(
candidate
);
}
writer
.
println
();
writer
.
println
(
"It was loaded from the following location:"
);
writer
.
println
();
writer
.
print
(
" "
);
writer
.
println
(
actual
);
return
new
FailureAnalysis
(
description
.
toString
(),
String
description
=
getDescription
(
cause
,
className
,
candidates
,
actual
);
return
new
FailureAnalysis
(
description
,
"Correct the classpath of your application so that it contains a single,"
+
" compatible version of "
+
className
,
cause
);
...
...
@@ -105,4 +89,26 @@ class NoSuchMethodFailureAnalyzer extends AbstractFailureAnalyzer<NoSuchMethodEr
}
}
private
String
getDescription
(
NoSuchMethodError
cause
,
String
className
,
List
<
URL
>
candidates
,
URL
actual
)
{
StringWriter
description
=
new
StringWriter
();
PrintWriter
writer
=
new
PrintWriter
(
description
);
writer
.
print
(
"An attempt was made to call the method "
);
writer
.
print
(
cause
.
getMessage
());
writer
.
print
(
" but it does not exist. Its class, "
);
writer
.
print
(
className
);
writer
.
println
(
", is available from the following locations:"
);
writer
.
println
();
for
(
URL
candidate
:
candidates
)
{
writer
.
print
(
" "
);
writer
.
println
(
candidate
);
}
writer
.
println
();
writer
.
println
(
"It was loaded from the following location:"
);
writer
.
println
();
writer
.
print
(
" "
);
writer
.
println
(
actual
);
return
description
.
toString
();
}
}
spring-boot/src/main/java/org/springframework/boot/web/support/SpringBootServletInitializer.java
View file @
a085541d
...
...
@@ -195,7 +195,6 @@ public abstract class SpringBootServletInitializer implements WebApplicationInit
((
ConfigurableWebEnvironment
)
environment
)
.
initPropertySources
(
this
.
servletContext
,
null
);
}
}
@Override
...
...
spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java
View file @
a085541d
...
...
@@ -383,14 +383,14 @@ public class JettyEmbeddedServletContainerFactoryTests
contexts
.
iterator
().
next
().
addEventListener
(
new
ServletContextListener
()
{
@Override
public
void
contextInitialized
(
ServletContextEvent
sce
)
{
public
void
contextInitialized
(
ServletContextEvent
event
)
{
throw
new
RuntimeException
();
}
@Override
public
void
contextDestroyed
(
ServletContextEvent
sce
)
{
public
void
contextDestroyed
(
ServletContextEvent
event
)
{
}
});
}
...
...
spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/NoSuchMethodFailureAnalyzerTests.java
View file @
a085541d
...
...
@@ -30,7 +30,9 @@ import static org.assertj.core.api.Assertions.assertThat;
import
static
org
.
mockito
.
Mockito
.
mock
;
/**
* @author awilkinson
* Tests for {@link NoSuchMethodFailureAnalyzer}.
*
* @author Andy Wilkinson
*/
@RunWith
(
ModifiedClassPathRunner
.
class
)
@ClassPathOverrides
(
"javax.servlet:servlet-api:2.5"
)
...
...
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