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
764a0a9a
Commit
764a0a9a
authored
Jul 06, 2013
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor change to code formatting
parent
a6341dc0
Changes
84
Hide whitespace changes
Inline
Side-by-side
Showing
84 changed files
with
391 additions
and
214 deletions
+391
-214
org.eclipse.jdt.core.prefs
eclipse/org.eclipse.jdt.core.prefs
+4
-4
AuditEvent.java
...va/org/springframework/zero/actuate/audit/AuditEvent.java
+2
-1
EndpointWebMvcAutoConfiguration.java
...ctuate/autoconfigure/EndpointWebMvcAutoConfiguration.java
+4
-2
ManagementServerPropertiesAutoConfiguration.java
...onfigure/ManagementServerPropertiesAutoConfiguration.java
+1
-1
MetricFilterAutoConfiguration.java
.../actuate/autoconfigure/MetricFilterAutoConfiguration.java
+6
-3
SecurityAutoConfiguration.java
...zero/actuate/autoconfigure/SecurityAutoConfiguration.java
+3
-3
ShutdownEndpoint.java
...ringframework/zero/actuate/endpoint/ShutdownEndpoint.java
+2
-1
EndpointHandlerAdapter.java
...ork/zero/actuate/endpoint/mvc/EndpointHandlerAdapter.java
+4
-2
DefaultCounterService.java
...framework/zero/actuate/metrics/DefaultCounterService.java
+2
-1
DefaultGaugeService.java
...ngframework/zero/actuate/metrics/DefaultGaugeService.java
+2
-1
InMemoryMetricRepository.java
...mework/zero/actuate/metrics/InMemoryMetricRepository.java
+4
-2
AuthenticationAuditListener.java
...rk/zero/actuate/security/AuthenticationAuditListener.java
+4
-2
AuthorizationAuditListener.java
...ork/zero/actuate/security/AuthorizationAuditListener.java
+2
-1
WebRequestTraceFilter.java
...ngframework/zero/actuate/trace/WebRequestTraceFilter.java
+4
-2
BasicErrorController.java
...pringframework/zero/actuate/web/BasicErrorController.java
+6
-3
EndpointWebMvcAutoConfigurationTests.java
...e/autoconfigure/EndpointWebMvcAutoConfigurationTests.java
+6
-3
AutoConfigurationUtils.java
...gframework/zero/autoconfigure/AutoConfigurationUtils.java
+4
-2
BasicDataSourceConfiguration.java
...zero/autoconfigure/jdbc/BasicDataSourceConfiguration.java
+2
-1
JpaAutoConfiguration.java
...work/zero/autoconfigure/orm/jpa/JpaAutoConfiguration.java
+4
-2
ThymeleafAutoConfiguration.java
...o/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java
+2
-1
WebMvcAutoConfiguration.java
...ework/zero/autoconfigure/web/WebMvcAutoConfiguration.java
+1
-1
AutoConfigurationSorter.java
...work/zero/context/annotation/AutoConfigurationSorter.java
+2
-1
ComponentScanDetector.java
...mework/zero/context/annotation/ComponentScanDetector.java
+4
-2
EnableAutoConfigurationImportSelector.java
...ext/annotation/EnableAutoConfigurationImportSelector.java
+2
-1
Spring.java
...e/src/main/java/org/springframework/zero/main/Spring.java
+6
-3
ServerPropertiesAutoConfigurationTests.java
...configure/web/ServerPropertiesAutoConfigurationTests.java
+10
-10
SpringZeroCli.java
...main/java/org/springframework/zero/cli/SpringZeroCli.java
+10
-9
SpringZeroCliException.java
.../org/springframework/zero/cli/SpringZeroCliException.java
+1
-2
CleanCommand.java
...va/org/springframework/zero/cli/command/CleanCommand.java
+7
-4
OptionHandler.java
...a/org/springframework/zero/cli/command/OptionHandler.java
+2
-1
ScriptCommand.java
...a/org/springframework/zero/cli/command/ScriptCommand.java
+22
-11
DependencyCustomizer.java
...ringframework/zero/cli/compiler/DependencyCustomizer.java
+8
-4
GroovyCompiler.java
...org/springframework/zero/cli/compiler/GroovyCompiler.java
+5
-4
SpringMvcCompilerAutoConfiguration.java
...ler/autoconfigure/SpringMvcCompilerAutoConfiguration.java
+3
-3
SpringZeroCompilerAutoConfiguration.java
...er/autoconfigure/SpringZeroCompilerAutoConfiguration.java
+2
-1
SpringZeroRunner.java
...org/springframework/zero/cli/runner/SpringZeroRunner.java
+16
-8
GroovyTemplate.java
...org/springframework/zero/cli/template/GroovyTemplate.java
+4
-2
BeanDefinitionLoader.java
...n/java/org/springframework/zero/BeanDefinitionLoader.java
+2
-1
SpringApplication.java
...main/java/org/springframework/zero/SpringApplication.java
+16
-8
CustomPropertyConstructor.java
.../springframework/zero/bind/CustomPropertyConstructor.java
+2
-1
InetAddressEditor.java
...java/org/springframework/zero/bind/InetAddressEditor.java
+2
-1
PropertiesConfigurationFactory.java
...ngframework/zero/bind/PropertiesConfigurationFactory.java
+8
-4
PropertySourcesPropertyValues.java
...ingframework/zero/bind/PropertySourcesPropertyValues.java
+2
-1
RelaxedDataBinder.java
...java/org/springframework/zero/bind/RelaxedDataBinder.java
+4
-2
YamlConfigurationFactory.java
...g/springframework/zero/bind/YamlConfigurationFactory.java
+2
-1
JacksonJsonParser.java
...va/org/springframework/zero/config/JacksonJsonParser.java
+4
-2
SimpleJsonParser.java
...ava/org/springframework/zero/config/SimpleJsonParser.java
+8
-4
YamlMapFactoryBean.java
...a/org/springframework/zero/config/YamlMapFactoryBean.java
+2
-1
YamlProcessor.java
...n/java/org/springframework/zero/config/YamlProcessor.java
+16
-8
AbstractOnBeanCondition.java
...work/zero/context/annotation/AbstractOnBeanCondition.java
+6
-3
ConfigurationPropertiesBindingConfiguration.java
...notation/ConfigurationPropertiesBindingConfiguration.java
+6
-3
PropertySourcesBindingPostProcessor.java
...ntext/annotation/PropertySourcesBindingPostProcessor.java
+4
-2
AbstractEmbeddedServletContainerFactory.java
...ext/embedded/AbstractEmbeddedServletContainerFactory.java
+2
-1
EmbeddedWebApplicationContext.java
.../zero/context/embedded/EmbeddedWebApplicationContext.java
+10
-5
FilterRegistrationBean.java
...amework/zero/context/embedded/FilterRegistrationBean.java
+2
-1
JettyEmbeddedServletContainer.java
...context/embedded/jetty/JettyEmbeddedServletContainer.java
+6
-3
JettyEmbeddedServletContainerFactory.java
.../embedded/jetty/JettyEmbeddedServletContainerFactory.java
+6
-3
ServletContextInitializerLifecycleListener.java
...ed/tomcat/ServletContextInitializerLifecycleListener.java
+2
-1
TomcatEmbeddedServletContainer.java
...ntext/embedded/tomcat/TomcatEmbeddedServletContainer.java
+6
-3
TomcatEmbeddedServletContainerFactory.java
...mbedded/tomcat/TomcatEmbeddedServletContainerFactory.java
+4
-2
ConfigFileApplicationContextInitializer.java
.../initializer/ConfigFileApplicationContextInitializer.java
+6
-3
ContextIdApplicationContextInitializer.java
...t/initializer/ContextIdApplicationContextInitializer.java
+2
-1
EnvironmentDelegateApplicationContextInitializer.java
...zer/EnvironmentDelegateApplicationContextInitializer.java
+2
-1
LoggingApplicationContextInitializer.java
...ext/initializer/LoggingApplicationContextInitializer.java
+4
-2
VcapApplicationContextInitializer.java
...ontext/initializer/VcapApplicationContextInitializer.java
+10
-5
JavaLoggerConfigurer.java
...rg/springframework/zero/logging/JavaLoggerConfigurer.java
+6
-3
LogbackConfigurer.java
...a/org/springframework/zero/logging/LogbackConfigurer.java
+2
-1
SpringServletInitializer.java
...rg/springframework/zero/web/SpringServletInitializer.java
+2
-1
SpringApplicationTests.java
...java/org/springframework/zero/SpringApplicationTests.java
+2
-1
AbstractEmbeddedServletContainerFactoryTests.java
...mbedded/AbstractEmbeddedServletContainerFactoryTests.java
+6
-3
EmbeddedServletContainerMvcIntegrationTests.java
...embedded/EmbeddedServletContainerMvcIntegrationTests.java
+4
-2
MockEmbeddedServletContainerFactory.java
...context/embedded/MockEmbeddedServletContainerFactory.java
+2
-1
Launcher.java
...main/java/org/springframework/zero/launcher/Launcher.java
+2
-1
MainMethodRunner.java
...a/org/springframework/zero/launcher/MainMethodRunner.java
+2
-1
WarLauncher.java
...n/java/org/springframework/zero/launcher/WarLauncher.java
+2
-1
RandomAccessDataFile.java
...ingframework/zero/launcher/data/RandomAccessDataFile.java
+10
-5
RandomAccessJarFile.java
...pringframework/zero/launcher/jar/RandomAccessJarFile.java
+8
-4
RandomAccessDataZipInputStreamTest.java
...zero/launcher/jar/RandomAccessDataZipInputStreamTest.java
+4
-2
RandomAccessJarFileTest.java
...gframework/zero/launcher/jar/RandomAccessJarFileTest.java
+2
-1
AbstractExecutableArchiveMojo.java
...ngframework/zero/maven/AbstractExecutableArchiveMojo.java
+8
-4
MainClassFinder.java
.../java/org/springframework/zero/maven/MainClassFinder.java
+4
-2
MainClassFinderTests.java
.../org/springframework/zero/maven/MainClassFinderTests.java
+2
-1
SampleProfileApplicationTests.java
...rk/zero/sample/profile/SampleProfileApplicationTests.java
+2
-1
SampleSimpleApplicationTests.java
...work/zero/sample/simple/SampleSimpleApplicationTests.java
+2
-1
No files found.
eclipse/org.eclipse.jdt.core.prefs
View file @
764a0a9a
...
@@ -193,11 +193,11 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
...
@@ -193,11 +193,11 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=
do not
insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=
do not
insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=
do not
insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=
do not
insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/audit/AuditEvent.java
View file @
764a0a9a
...
@@ -93,7 +93,8 @@ public class AuditEvent implements Serializable {
...
@@ -93,7 +93,8 @@ public class AuditEvent implements Serializable {
if
(
entry
.
contains
(
"="
))
{
if
(
entry
.
contains
(
"="
))
{
int
index
=
entry
.
indexOf
(
"="
);
int
index
=
entry
.
indexOf
(
"="
);
result
.
put
(
entry
.
substring
(
0
,
index
),
entry
.
substring
(
index
+
1
));
result
.
put
(
entry
.
substring
(
0
,
index
),
entry
.
substring
(
index
+
1
));
}
else
{
}
else
{
result
.
put
(
entry
,
null
);
result
.
put
(
entry
,
null
);
}
}
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java
View file @
764a0a9a
...
@@ -140,7 +140,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
...
@@ -140,7 +140,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
ServerProperties
serverProperties
;
ServerProperties
serverProperties
;
try
{
try
{
serverProperties
=
beanFactory
.
getBean
(
ServerProperties
.
class
);
serverProperties
=
beanFactory
.
getBean
(
ServerProperties
.
class
);
}
catch
(
NoSuchBeanDefinitionException
ex
)
{
}
catch
(
NoSuchBeanDefinitionException
ex
)
{
serverProperties
=
new
ServerProperties
();
serverProperties
=
new
ServerProperties
();
}
}
...
@@ -148,7 +149,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
...
@@ -148,7 +149,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
try
{
try
{
managementServerProperties
=
beanFactory
managementServerProperties
=
beanFactory
.
getBean
(
ManagementServerProperties
.
class
);
.
getBean
(
ManagementServerProperties
.
class
);
}
catch
(
NoSuchBeanDefinitionException
ex
)
{
}
catch
(
NoSuchBeanDefinitionException
ex
)
{
managementServerProperties
=
new
ManagementServerProperties
();
managementServerProperties
=
new
ManagementServerProperties
();
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java
View file @
764a0a9a
...
@@ -27,7 +27,7 @@ import org.springframework.zero.context.annotation.EnableConfigurationProperties
...
@@ -27,7 +27,7 @@ import org.springframework.zero.context.annotation.EnableConfigurationProperties
/**
/**
* {@link EnableAutoConfiguration Auto-configuration} for the
* {@link EnableAutoConfiguration Auto-configuration} for the
* {@link ManagementServerPropertiesAutoConfiguration} bean.
* {@link ManagementServerPropertiesAutoConfiguration} bean.
*
*
* @author Dave Syer
* @author Dave Syer
*/
*/
@Configuration
@Configuration
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/MetricFilterAutoConfiguration.java
View file @
764a0a9a
...
@@ -83,7 +83,8 @@ public class MetricFilterAutoConfiguration {
...
@@ -83,7 +83,8 @@ public class MetricFilterAutoConfiguration {
&&
(
response
instanceof
HttpServletResponse
))
{
&&
(
response
instanceof
HttpServletResponse
))
{
doFilter
((
HttpServletRequest
)
request
,
(
HttpServletResponse
)
response
,
doFilter
((
HttpServletRequest
)
request
,
(
HttpServletResponse
)
response
,
chain
);
chain
);
}
else
{
}
else
{
chain
.
doFilter
(
request
,
response
);
chain
.
doFilter
(
request
,
response
);
}
}
}
}
...
@@ -96,7 +97,8 @@ public class MetricFilterAutoConfiguration {
...
@@ -96,7 +97,8 @@ public class MetricFilterAutoConfiguration {
stopWatch
.
start
();
stopWatch
.
start
();
try
{
try
{
chain
.
doFilter
(
request
,
response
);
chain
.
doFilter
(
request
,
response
);
}
finally
{
}
finally
{
stopWatch
.
stop
();
stopWatch
.
stop
();
String
gaugeKey
=
getKey
(
"response"
+
suffix
);
String
gaugeKey
=
getKey
(
"response"
+
suffix
);
MetricFilterAutoConfiguration
.
this
.
gaugeService
.
set
(
gaugeKey
,
MetricFilterAutoConfiguration
.
this
.
gaugeService
.
set
(
gaugeKey
,
...
@@ -109,7 +111,8 @@ public class MetricFilterAutoConfiguration {
...
@@ -109,7 +111,8 @@ public class MetricFilterAutoConfiguration {
private
int
getStatus
(
HttpServletResponse
response
)
{
private
int
getStatus
(
HttpServletResponse
response
)
{
try
{
try
{
return
response
.
getStatus
();
return
response
.
getStatus
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
UNDEFINED_HTTP_STATUS
;
return
UNDEFINED_HTTP_STATUS
;
}
}
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/autoconfigure/SecurityAutoConfiguration.java
View file @
764a0a9a
...
@@ -58,12 +58,12 @@ import org.springframework.zero.context.annotation.EnableConfigurationProperties
...
@@ -58,12 +58,12 @@ import org.springframework.zero.context.annotation.EnableConfigurationProperties
* password=password)</code> but can easily be customized by providing a bean definition
* password=password)</code> but can easily be customized by providing a bean definition
* of type {@link AuthenticationManager}. Also provides audit logging of authentication
* of type {@link AuthenticationManager}. Also provides audit logging of authentication
* events.
* events.
*
*
* <p>
* <p>
* The framework {@link Endpoint}s (used to expose application information to operations)
* The framework {@link Endpoint}s (used to expose application information to operations)
* include a {@link Endpoint#isSensitive() sensitive} configuration option which will be
* include a {@link Endpoint#isSensitive() sensitive} configuration option which will be
* used as a security hint by the filter created here.
* used as a security hint by the filter created here.
*
*
* <p>
* <p>
* Some common simple customizations:
* Some common simple customizations:
* <ul>
* <ul>
...
@@ -75,7 +75,7 @@ import org.springframework.zero.context.annotation.EnableConfigurationProperties
...
@@ -75,7 +75,7 @@ import org.springframework.zero.context.annotation.EnableConfigurationProperties
* <li>Add form login for user facing resources: add a
* <li>Add form login for user facing resources: add a
* {@link WebSecurityConfigurerAdapter} and use {@link HttpSecurity#formLogin()}</li>
* {@link WebSecurityConfigurerAdapter} and use {@link HttpSecurity#formLogin()}</li>
* </ul>
* </ul>
*
*
* @author Dave Syer
* @author Dave Syer
*/
*/
@Configuration
@Configuration
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/ShutdownEndpoint.java
View file @
764a0a9a
...
@@ -61,7 +61,8 @@ public class ShutdownEndpoint extends AbstractEndpoint<Map<String, Object>> impl
...
@@ -61,7 +61,8 @@ public class ShutdownEndpoint extends AbstractEndpoint<Map<String, Object>> impl
public
void
run
()
{
public
void
run
()
{
try
{
try
{
Thread
.
sleep
(
500L
);
Thread
.
sleep
(
500L
);
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
}
}
ShutdownEndpoint
.
this
.
context
.
close
();
ShutdownEndpoint
.
this
.
context
.
close
();
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/endpoint/mvc/EndpointHandlerAdapter.java
View file @
764a0a9a
...
@@ -112,7 +112,8 @@ public class EndpointHandlerAdapter implements HandlerAdapter {
...
@@ -112,7 +112,8 @@ public class EndpointHandlerAdapter implements HandlerAdapter {
}
}
}
}
throw
new
HttpMediaTypeNotAcceptableException
(
this
.
allSupportedMediaTypes
);
throw
new
HttpMediaTypeNotAcceptableException
(
this
.
allSupportedMediaTypes
);
}
finally
{
}
finally
{
outputMessage
.
close
();
outputMessage
.
close
();
}
}
}
}
...
@@ -179,7 +180,8 @@ public class EndpointHandlerAdapter implements HandlerAdapter {
...
@@ -179,7 +180,8 @@ public class EndpointHandlerAdapter implements HandlerAdapter {
if
(
mediaType
.
isConcrete
())
{
if
(
mediaType
.
isConcrete
())
{
selectedMediaType
=
mediaType
;
selectedMediaType
=
mediaType
;
break
;
break
;
}
else
if
(
mediaType
.
equals
(
MediaType
.
ALL
)
}
else
if
(
mediaType
.
equals
(
MediaType
.
ALL
)
||
mediaType
.
equals
(
MEDIA_TYPE_APPLICATION
))
{
||
mediaType
.
equals
(
MEDIA_TYPE_APPLICATION
))
{
selectedMediaType
=
MediaType
.
APPLICATION_OCTET_STREAM
;
selectedMediaType
=
MediaType
.
APPLICATION_OCTET_STREAM
;
break
;
break
;
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/DefaultCounterService.java
View file @
764a0a9a
...
@@ -54,7 +54,8 @@ public class DefaultCounterService implements CounterService {
...
@@ -54,7 +54,8 @@ public class DefaultCounterService implements CounterService {
private
String
wrap
(
String
metricName
)
{
private
String
wrap
(
String
metricName
)
{
if
(
metricName
.
startsWith
(
"counter"
))
{
if
(
metricName
.
startsWith
(
"counter"
))
{
return
metricName
;
return
metricName
;
}
else
{
}
else
{
return
"counter."
+
metricName
;
return
"counter."
+
metricName
;
}
}
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/DefaultGaugeService.java
View file @
764a0a9a
...
@@ -43,7 +43,8 @@ public class DefaultGaugeService implements GaugeService {
...
@@ -43,7 +43,8 @@ public class DefaultGaugeService implements GaugeService {
private
String
wrap
(
String
metricName
)
{
private
String
wrap
(
String
metricName
)
{
if
(
metricName
.
startsWith
(
"gauge"
))
{
if
(
metricName
.
startsWith
(
"gauge"
))
{
return
metricName
;
return
metricName
;
}
else
{
}
else
{
return
"gauge."
+
metricName
;
return
"gauge."
+
metricName
;
}
}
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/metrics/InMemoryMetricRepository.java
View file @
764a0a9a
...
@@ -37,7 +37,8 @@ public class InMemoryMetricRepository implements MetricRepository {
...
@@ -37,7 +37,8 @@ public class InMemoryMetricRepository implements MetricRepository {
Metric
metric
=
current
.
getMetric
();
Metric
metric
=
current
.
getMetric
();
this
.
metrics
.
replace
(
metricName
,
current
,
this
.
metrics
.
replace
(
metricName
,
current
,
new
Measurement
(
timestamp
,
metric
.
increment
(
amount
)));
new
Measurement
(
timestamp
,
metric
.
increment
(
amount
)));
}
else
{
}
else
{
this
.
metrics
.
putIfAbsent
(
metricName
,
new
Measurement
(
timestamp
,
new
Metric
(
this
.
metrics
.
putIfAbsent
(
metricName
,
new
Measurement
(
timestamp
,
new
Metric
(
metricName
,
amount
)));
metricName
,
amount
)));
}
}
...
@@ -50,7 +51,8 @@ public class InMemoryMetricRepository implements MetricRepository {
...
@@ -50,7 +51,8 @@ public class InMemoryMetricRepository implements MetricRepository {
Metric
metric
=
current
.
getMetric
();
Metric
metric
=
current
.
getMetric
();
this
.
metrics
.
replace
(
metricName
,
current
,
this
.
metrics
.
replace
(
metricName
,
current
,
new
Measurement
(
timestamp
,
metric
.
set
(
value
)));
new
Measurement
(
timestamp
,
metric
.
set
(
value
)));
}
else
{
}
else
{
this
.
metrics
.
putIfAbsent
(
metricName
,
new
Measurement
(
timestamp
,
new
Metric
(
this
.
metrics
.
putIfAbsent
(
metricName
,
new
Measurement
(
timestamp
,
new
Metric
(
metricName
,
value
)));
metricName
,
value
)));
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/security/AuthenticationAuditListener.java
View file @
764a0a9a
...
@@ -48,9 +48,11 @@ public class AuthenticationAuditListener implements
...
@@ -48,9 +48,11 @@ public class AuthenticationAuditListener implements
public
void
onApplicationEvent
(
AbstractAuthenticationEvent
event
)
{
public
void
onApplicationEvent
(
AbstractAuthenticationEvent
event
)
{
if
(
event
instanceof
AbstractAuthenticationFailureEvent
)
{
if
(
event
instanceof
AbstractAuthenticationFailureEvent
)
{
onAuthenticationFailureEvent
((
AbstractAuthenticationFailureEvent
)
event
);
onAuthenticationFailureEvent
((
AbstractAuthenticationFailureEvent
)
event
);
}
else
if
(
event
instanceof
AuthenticationSwitchUserEvent
)
{
}
else
if
(
event
instanceof
AuthenticationSwitchUserEvent
)
{
onAuthenticationSwitchUserEvent
((
AuthenticationSwitchUserEvent
)
event
);
onAuthenticationSwitchUserEvent
((
AuthenticationSwitchUserEvent
)
event
);
}
else
{
}
else
{
onAuthenticationEvent
(
event
);
onAuthenticationEvent
(
event
);
}
}
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/security/AuthorizationAuditListener.java
View file @
764a0a9a
...
@@ -48,7 +48,8 @@ public class AuthorizationAuditListener implements
...
@@ -48,7 +48,8 @@ public class AuthorizationAuditListener implements
public
void
onApplicationEvent
(
AbstractAuthorizationEvent
event
)
{
public
void
onApplicationEvent
(
AbstractAuthorizationEvent
event
)
{
if
(
event
instanceof
AuthenticationCredentialsNotFoundEvent
)
{
if
(
event
instanceof
AuthenticationCredentialsNotFoundEvent
)
{
onAuthenticationCredentialsNotFoundEvent
((
AuthenticationCredentialsNotFoundEvent
)
event
);
onAuthenticationCredentialsNotFoundEvent
((
AuthenticationCredentialsNotFoundEvent
)
event
);
}
else
if
(
event
instanceof
AuthorizationFailureEvent
)
{
}
else
if
(
event
instanceof
AuthorizationFailureEvent
)
{
onAuthorizationFailureEvent
((
AuthorizationFailureEvent
)
event
);
onAuthorizationFailureEvent
((
AuthorizationFailureEvent
)
event
);
}
}
}
}
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/trace/WebRequestTraceFilter.java
View file @
764a0a9a
...
@@ -101,7 +101,8 @@ public class WebRequestTraceFilter implements Filter, Ordered {
...
@@ -101,7 +101,8 @@ public class WebRequestTraceFilter implements Filter, Ordered {
.
get
(
"headers"
);
.
get
(
"headers"
);
this
.
logger
.
trace
(
"Headers: "
this
.
logger
.
trace
(
"Headers: "
+
this
.
objectMapper
.
writeValueAsString
(
headers
));
+
this
.
objectMapper
.
writeValueAsString
(
headers
));
}
catch
(
JsonProcessingException
e
)
{
}
catch
(
JsonProcessingException
e
)
{
throw
new
IllegalStateException
(
"Cannot create JSON"
,
e
);
throw
new
IllegalStateException
(
"Cannot create JSON"
,
e
);
}
}
}
}
...
@@ -121,7 +122,8 @@ public class WebRequestTraceFilter implements Filter, Ordered {
...
@@ -121,7 +122,8 @@ public class WebRequestTraceFilter implements Filter, Ordered {
Object
value
=
values
;
Object
value
=
values
;
if
(
values
.
size
()
==
1
)
{
if
(
values
.
size
()
==
1
)
{
value
=
values
.
get
(
0
);
value
=
values
.
get
(
0
);
}
else
if
(
values
.
isEmpty
())
{
}
else
if
(
values
.
isEmpty
())
{
value
=
""
;
value
=
""
;
}
}
map
.
put
(
name
,
value
);
map
.
put
(
name
,
value
);
...
...
spring-zero-actuator/src/main/java/org/springframework/zero/actuate/web/BasicErrorController.java
View file @
764a0a9a
...
@@ -76,7 +76,8 @@ public class BasicErrorController implements ErrorController {
...
@@ -76,7 +76,8 @@ public class BasicErrorController implements ErrorController {
if
(
obj
!=
null
)
{
if
(
obj
!=
null
)
{
status
=
(
Integer
)
obj
;
status
=
(
Integer
)
obj
;
map
.
put
(
"error"
,
HttpStatus
.
valueOf
(
status
).
getReasonPhrase
());
map
.
put
(
"error"
,
HttpStatus
.
valueOf
(
status
).
getReasonPhrase
());
}
else
{
}
else
{
map
.
put
(
"error"
,
"None"
);
map
.
put
(
"error"
,
"None"
);
}
}
map
.
put
(
"status"
,
status
);
map
.
put
(
"status"
,
status
);
...
@@ -94,12 +95,14 @@ public class BasicErrorController implements ErrorController {
...
@@ -94,12 +95,14 @@ public class BasicErrorController implements ErrorController {
map
.
put
(
"trace"
,
stackTrace
.
toString
());
map
.
put
(
"trace"
,
stackTrace
.
toString
());
}
}
this
.
logger
.
error
(
error
);
this
.
logger
.
error
(
error
);
}
else
{
}
else
{
Object
message
=
request
.
getAttribute
(
"javax.servlet.error.message"
);
Object
message
=
request
.
getAttribute
(
"javax.servlet.error.message"
);
map
.
put
(
"message"
,
message
==
null
?
"No message available"
:
message
);
map
.
put
(
"message"
,
message
==
null
?
"No message available"
:
message
);
}
}
return
map
;
return
map
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
map
.
put
(
"error"
,
e
.
getClass
().
getName
());
map
.
put
(
"error"
,
e
.
getClass
().
getName
());
map
.
put
(
"message"
,
e
.
getMessage
());
map
.
put
(
"message"
,
e
.
getMessage
());
this
.
logger
.
error
(
e
);
this
.
logger
.
error
(
e
);
...
...
spring-zero-actuator/src/test/java/org/springframework/zero/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java
View file @
764a0a9a
...
@@ -61,7 +61,8 @@ public class EndpointWebMvcAutoConfigurationTests {
...
@@ -61,7 +61,8 @@ public class EndpointWebMvcAutoConfigurationTests {
public
void
close
()
{
public
void
close
()
{
try
{
try
{
this
.
applicationContext
.
close
();
this
.
applicationContext
.
close
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
}
}
}
}
...
@@ -168,10 +169,12 @@ public class EndpointWebMvcAutoConfigurationTests {
...
@@ -168,10 +169,12 @@ public class EndpointWebMvcAutoConfigurationTests {
String
actual
=
StreamUtils
.
copyToString
(
response
.
getBody
(),
String
actual
=
StreamUtils
.
copyToString
(
response
.
getBody
(),
Charset
.
forName
(
"UTF-8"
));
Charset
.
forName
(
"UTF-8"
));
assertThat
(
actual
,
equalTo
(
expected
));
assertThat
(
actual
,
equalTo
(
expected
));
}
finally
{
}
finally
{
response
.
close
();
response
.
close
();
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
if
(
expected
==
null
)
{
if
(
expected
==
null
)
{
if
(
SocketException
.
class
.
isInstance
(
ex
)
if
(
SocketException
.
class
.
isInstance
(
ex
)
||
FileNotFoundException
.
class
.
isInstance
(
ex
))
{
||
FileNotFoundException
.
class
.
isInstance
(
ex
))
{
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/AutoConfigurationUtils.java
View file @
764a0a9a
...
@@ -40,7 +40,8 @@ public abstract class AutoConfigurationUtils {
...
@@ -40,7 +40,8 @@ public abstract class AutoConfigurationUtils {
public
static
List
<
String
>
getBasePackages
(
BeanFactory
beanFactory
)
{
public
static
List
<
String
>
getBasePackages
(
BeanFactory
beanFactory
)
{
try
{
try
{
return
beanFactory
.
getBean
(
BASE_PACKAGES_BEAN
,
List
.
class
);
return
beanFactory
.
getBean
(
BASE_PACKAGES_BEAN
,
List
.
class
);
}
catch
(
NoSuchBeanDefinitionException
e
)
{
}
catch
(
NoSuchBeanDefinitionException
e
)
{
return
Collections
.
emptyList
();
return
Collections
.
emptyList
();
}
}
}
}
...
@@ -50,7 +51,8 @@ public abstract class AutoConfigurationUtils {
...
@@ -50,7 +51,8 @@ public abstract class AutoConfigurationUtils {
if
(!
beanFactory
.
containsBean
(
BASE_PACKAGES_BEAN
))
{
if
(!
beanFactory
.
containsBean
(
BASE_PACKAGES_BEAN
))
{
beanFactory
.
registerSingleton
(
BASE_PACKAGES_BEAN
,
new
ArrayList
<
String
>(
beanFactory
.
registerSingleton
(
BASE_PACKAGES_BEAN
,
new
ArrayList
<
String
>(
basePackages
));
basePackages
));
}
else
{
}
else
{
List
<
String
>
packages
=
getBasePackages
(
beanFactory
);
List
<
String
>
packages
=
getBasePackages
(
beanFactory
);
for
(
String
pkg
:
basePackages
)
{
for
(
String
pkg
:
basePackages
)
{
if
(
packages
.
contains
(
pkg
))
{
if
(
packages
.
contains
(
pkg
))
{
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/jdbc/BasicDataSourceConfiguration.java
View file @
764a0a9a
...
@@ -58,7 +58,8 @@ public class BasicDataSourceConfiguration extends AbstractDataSourceConfiguratio
...
@@ -58,7 +58,8 @@ public class BasicDataSourceConfiguration extends AbstractDataSourceConfiguratio
if
(
this
.
pool
!=
null
)
{
if
(
this
.
pool
!=
null
)
{
try
{
try
{
this
.
pool
.
close
();
this
.
pool
.
close
();
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
throw
new
DataAccessResourceFailureException
(
throw
new
DataAccessResourceFailureException
(
"Could not close data source"
,
e
);
"Could not close data source"
,
e
);
}
}
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/orm/jpa/JpaAutoConfiguration.java
View file @
764a0a9a
...
@@ -78,7 +78,8 @@ public abstract class JpaAutoConfiguration implements BeanFactoryAware {
...
@@ -78,7 +78,8 @@ public abstract class JpaAutoConfiguration implements BeanFactoryAware {
.
getBeanDefinition
(
"dataSource"
);
.
getBeanDefinition
(
"dataSource"
);
return
EmbeddedDatabaseConfiguration
.
class
.
getName
().
equals
(
return
EmbeddedDatabaseConfiguration
.
class
.
getName
().
equals
(
beanDefinition
.
getFactoryBeanName
());
beanDefinition
.
getFactoryBeanName
());
}
catch
(
NoSuchBeanDefinitionException
e
)
{
}
catch
(
NoSuchBeanDefinitionException
e
)
{
return
false
;
return
false
;
}
}
}
}
...
@@ -89,7 +90,8 @@ public abstract class JpaAutoConfiguration implements BeanFactoryAware {
...
@@ -89,7 +90,8 @@ public abstract class JpaAutoConfiguration implements BeanFactoryAware {
protected
DataSource
getDataSource
()
{
protected
DataSource
getDataSource
()
{
try
{
try
{
return
this
.
beanFactory
.
getBean
(
"dataSource"
,
DataSource
.
class
);
return
this
.
beanFactory
.
getBean
(
"dataSource"
,
DataSource
.
class
);
}
catch
(
RuntimeException
e
)
{
}
catch
(
RuntimeException
e
)
{
return
this
.
beanFactory
.
getBean
(
DataSource
.
class
);
return
this
.
beanFactory
.
getBean
(
DataSource
.
class
);
}
}
}
}
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java
View file @
764a0a9a
...
@@ -84,7 +84,8 @@ public class ThymeleafAutoConfiguration {
...
@@ -84,7 +84,8 @@ public class ThymeleafAutoConfiguration {
try
{
try
{
return
DefaultTemplateResolverConfiguration
.
this
.
resourceLoader
return
DefaultTemplateResolverConfiguration
.
this
.
resourceLoader
.
getResource
(
resourceName
).
getInputStream
();
.
getResource
(
resourceName
).
getInputStream
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
return
null
;
return
null
;
}
}
}
}
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/autoconfigure/web/WebMvcAutoConfiguration.java
View file @
764a0a9a
...
@@ -56,7 +56,7 @@ import org.springframework.zero.context.annotation.EnableAutoConfiguration;
...
@@ -56,7 +56,7 @@ import org.springframework.zero.context.annotation.EnableAutoConfiguration;
/**
/**
* {@link EnableAutoConfiguration Auto-configuration} for {@link EnableWebMvc Web MVC}.
* {@link EnableAutoConfiguration Auto-configuration} for {@link EnableWebMvc Web MVC}.
*
*
* @author Phillip Webb
* @author Phillip Webb
* @author Dave Syer
* @author Dave Syer
*/
*/
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/AutoConfigurationSorter.java
View file @
764a0a9a
...
@@ -143,7 +143,8 @@ class AutoConfigurationSorter {
...
@@ -143,7 +143,8 @@ class AutoConfigurationSorter {
if
(
this
.
after
==
null
)
{
if
(
this
.
after
==
null
)
{
if
(
this
.
afterAnnotation
==
null
)
{
if
(
this
.
afterAnnotation
==
null
)
{
this
.
after
=
Collections
.
emptyList
();
this
.
after
=
Collections
.
emptyList
();
}
else
{
}
else
{
this
.
after
=
new
ArrayList
<
AutoConfigurationClass
>();
this
.
after
=
new
ArrayList
<
AutoConfigurationClass
>();
for
(
String
afterClass
:
(
String
[])
this
.
afterAnnotation
.
get
(
"value"
))
{
for
(
String
afterClass
:
(
String
[])
this
.
afterAnnotation
.
get
(
"value"
))
{
this
.
after
.
add
(
new
AutoConfigurationClass
(
afterClass
));
this
.
after
.
add
(
new
AutoConfigurationClass
(
afterClass
));
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/ComponentScanDetector.java
View file @
764a0a9a
...
@@ -70,7 +70,8 @@ class ComponentScanDetector implements ImportBeanDefinitionRegistrar, BeanFactor
...
@@ -70,7 +70,8 @@ class ComponentScanDetector implements ImportBeanDefinitionRegistrar, BeanFactor
private
void
storeComponentScanBasePackages
()
{
private
void
storeComponentScanBasePackages
()
{
if
(
this
.
beanFactory
instanceof
ConfigurableListableBeanFactory
)
{
if
(
this
.
beanFactory
instanceof
ConfigurableListableBeanFactory
)
{
storeComponentScanBasePackages
((
ConfigurableListableBeanFactory
)
this
.
beanFactory
);
storeComponentScanBasePackages
((
ConfigurableListableBeanFactory
)
this
.
beanFactory
);
}
else
{
}
else
{
if
(
this
.
logger
.
isWarnEnabled
())
{
if
(
this
.
logger
.
isWarnEnabled
())
{
this
.
logger
this
.
logger
.
warn
(
"Unable to read @ComponentScan annotations for auto-configure"
);
.
warn
(
"Unable to read @ComponentScan annotations for auto-configure"
);
...
@@ -109,7 +110,8 @@ class ComponentScanDetector implements ImportBeanDefinitionRegistrar, BeanFactor
...
@@ -109,7 +110,8 @@ class ComponentScanDetector implements ImportBeanDefinitionRegistrar, BeanFactor
MetadataReader
metadataReader
=
this
.
metadataReaderFactory
MetadataReader
metadataReader
=
this
.
metadataReaderFactory
.
getMetadataReader
(
className
);
.
getMetadataReader
(
className
);
return
metadataReader
.
getAnnotationMetadata
();
return
metadataReader
.
getAnnotationMetadata
();
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
if
(
this
.
logger
.
isDebugEnabled
())
{
if
(
this
.
logger
.
isDebugEnabled
())
{
this
.
logger
.
debug
(
this
.
logger
.
debug
(
"Could not find class file for introspecting @ComponentScan classes: "
"Could not find class file for introspecting @ComponentScan classes: "
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/context/annotation/EnableAutoConfigurationImportSelector.java
View file @
764a0a9a
...
@@ -69,7 +69,8 @@ class EnableAutoConfigurationImportSelector implements DeferredImportSelector,
...
@@ -69,7 +69,8 @@ class EnableAutoConfigurationImportSelector implements DeferredImportSelector,
factories
.
add
(
0
,
ComponentScanDetector
.
class
.
getName
());
factories
.
add
(
0
,
ComponentScanDetector
.
class
.
getName
());
return
factories
.
toArray
(
new
String
[
factories
.
size
()]);
return
factories
.
toArray
(
new
String
[
factories
.
size
()]);
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
throw
new
IllegalStateException
(
ex
);
throw
new
IllegalStateException
(
ex
);
}
}
}
}
...
...
spring-zero-autoconfigure/src/main/java/org/springframework/zero/main/Spring.java
View file @
764a0a9a
...
@@ -70,11 +70,14 @@ public class Spring {
...
@@ -70,11 +70,14 @@ public class Spring {
for
(
String
arg
:
args
)
{
for
(
String
arg
:
args
)
{
if
(
ClassUtils
.
isPresent
(
arg
,
null
))
{
if
(
ClassUtils
.
isPresent
(
arg
,
null
))
{
sources
.
add
(
ClassUtils
.
forName
(
arg
,
null
));
sources
.
add
(
ClassUtils
.
forName
(
arg
,
null
));
}
else
if
(
arg
.
endsWith
(
".xml"
))
{
}
else
if
(
arg
.
endsWith
(
".xml"
))
{
sources
.
add
(
arg
);
sources
.
add
(
arg
);
}
else
if
(!
scanner
.
findCandidateComponents
(
arg
).
isEmpty
())
{
}
else
if
(!
scanner
.
findCandidateComponents
(
arg
).
isEmpty
())
{
sources
.
add
(
arg
);
sources
.
add
(
arg
);
}
else
{
}
else
{
strings
.
add
(
arg
);
strings
.
add
(
arg
);
}
}
}
}
...
...
spring-zero-autoconfigure/src/test/java/org/springframework/zero/autoconfigure/web/ServerPropertiesAutoConfigurationTests.java
View file @
764a0a9a
...
@@ -56,8 +56,8 @@ public class ServerPropertiesAutoConfigurationTests {
...
@@ -56,8 +56,8 @@ public class ServerPropertiesAutoConfigurationTests {
@Before
@Before
public
void
init
()
{
public
void
init
()
{
containerFactory
=
containerFactory
=
Mockito
Mockito
.
mock
(
ConfigurableEmbeddedServletContainerFactory
.
class
);
.
mock
(
ConfigurableEmbeddedServletContainerFactory
.
class
);
}
}
@After
@After
...
@@ -70,8 +70,8 @@ public class ServerPropertiesAutoConfigurationTests {
...
@@ -70,8 +70,8 @@ public class ServerPropertiesAutoConfigurationTests {
@Test
@Test
public
void
createFromConfigClass
()
throws
Exception
{
public
void
createFromConfigClass
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigEmbeddedWebApplicationContext
();
this
.
context
=
new
AnnotationConfigEmbeddedWebApplicationContext
();
this
.
context
this
.
context
.
register
(
Config
.
class
,
ServerPropertiesAutoConfiguration
.
class
,
.
register
(
Config
.
class
,
ServerPropertiesAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
PropertyPlaceholderAutoConfiguration
.
class
);
TestUtils
.
addEnviroment
(
this
.
context
,
"server.port:9000"
);
TestUtils
.
addEnviroment
(
this
.
context
,
"server.port:9000"
);
this
.
context
.
refresh
();
this
.
context
.
refresh
();
ServerProperties
server
=
this
.
context
.
getBean
(
ServerProperties
.
class
);
ServerProperties
server
=
this
.
context
.
getBean
(
ServerProperties
.
class
);
...
@@ -84,8 +84,8 @@ public class ServerPropertiesAutoConfigurationTests {
...
@@ -84,8 +84,8 @@ public class ServerPropertiesAutoConfigurationTests {
public
void
tomcatProperties
()
throws
Exception
{
public
void
tomcatProperties
()
throws
Exception
{
containerFactory
=
Mockito
.
mock
(
TomcatEmbeddedServletContainerFactory
.
class
);
containerFactory
=
Mockito
.
mock
(
TomcatEmbeddedServletContainerFactory
.
class
);
this
.
context
=
new
AnnotationConfigEmbeddedWebApplicationContext
();
this
.
context
=
new
AnnotationConfigEmbeddedWebApplicationContext
();
this
.
context
this
.
context
.
register
(
Config
.
class
,
ServerPropertiesAutoConfiguration
.
class
,
.
register
(
Config
.
class
,
ServerPropertiesAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
PropertyPlaceholderAutoConfiguration
.
class
);
TestUtils
.
addEnviroment
(
this
.
context
,
"server.tomcat.basedir:target/foo"
);
TestUtils
.
addEnviroment
(
this
.
context
,
"server.tomcat.basedir:target/foo"
);
this
.
context
.
refresh
();
this
.
context
.
refresh
();
ServerProperties
server
=
this
.
context
.
getBean
(
ServerProperties
.
class
);
ServerProperties
server
=
this
.
context
.
getBean
(
ServerProperties
.
class
);
...
@@ -97,8 +97,9 @@ public class ServerPropertiesAutoConfigurationTests {
...
@@ -97,8 +97,9 @@ public class ServerPropertiesAutoConfigurationTests {
@Test
@Test
public
void
testAccidentalMultipleServerPropertiesBeans
()
throws
Exception
{
public
void
testAccidentalMultipleServerPropertiesBeans
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigEmbeddedWebApplicationContext
();
this
.
context
=
new
AnnotationConfigEmbeddedWebApplicationContext
();
this
.
context
this
.
context
.
register
(
Config
.
class
,
MutiServerPropertiesBeanConfig
.
class
,
.
register
(
Config
.
class
,
MutiServerPropertiesBeanConfig
.
class
,
ServerPropertiesAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
ServerPropertiesAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
this
.
thrown
.
expectCause
(
Matchers
this
.
thrown
.
expectCause
(
Matchers
.<
Throwable
>
instanceOf
(
NoUniqueBeanDefinitionException
.
class
));
.<
Throwable
>
instanceOf
(
NoUniqueBeanDefinitionException
.
class
));
this
.
context
.
refresh
();
this
.
context
.
refresh
();
...
@@ -113,8 +114,7 @@ public class ServerPropertiesAutoConfigurationTests {
...
@@ -113,8 +114,7 @@ public class ServerPropertiesAutoConfigurationTests {
}
}
@Bean
@Bean
public
EmbeddedServletContainerCustomizerBeanPostProcessor
public
EmbeddedServletContainerCustomizerBeanPostProcessor
embeddedServletContainerCustomizerBeanPostProcessor
()
{
embeddedServletContainerCustomizerBeanPostProcessor
()
{
return
new
EmbeddedServletContainerCustomizerBeanPostProcessor
();
return
new
EmbeddedServletContainerCustomizerBeanPostProcessor
();
}
}
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/SpringZeroCli.java
View file @
764a0a9a
...
@@ -24,14 +24,14 @@ import java.util.ServiceLoader;
...
@@ -24,14 +24,14 @@ import java.util.ServiceLoader;
import
java.util.Set
;
import
java.util.Set
;
/**
/**
* Spring Zero Command Line Interface. This is the main entry-point for the Spring
* Spring Zero Command Line Interface. This is the main entry-point for the Spring
Zero
*
Zero command line application. This class will parse input arguments and delegate
*
command line application. This class will parse input arguments and delegate to a
*
to a
suitable {@link Command} implementation based on the first argument.
* suitable {@link Command} implementation based on the first argument.
*
*
* <p>
* <p>
* The '-d' and '--debug' switches are handled by this class, however, most argument
* The '-d' and '--debug' switches are handled by this class, however, most argument
* parsing is left to the {@link Command} implementation.
* parsing is left to the {@link Command} implementation.
*
*
* @author Phillip Webb
* @author Phillip Webb
* @see #main(String...)
* @see #main(String...)
* @see SpringZeroCliException
* @see SpringZeroCliException
...
@@ -47,8 +47,7 @@ public class SpringZeroCli {
...
@@ -47,8 +47,7 @@ public class SpringZeroCli {
private
List
<
Command
>
commands
;
private
List
<
Command
>
commands
;
/**
/**
* Create a new {@link SpringZeroCli} implementation with the default set of
* Create a new {@link SpringZeroCli} implementation with the default set of commands.
* commands.
*/
*/
public
SpringZeroCli
()
{
public
SpringZeroCli
()
{
setCommands
(
ServiceLoader
.
load
(
CommandFactory
.
class
,
getClass
().
getClassLoader
()));
setCommands
(
ServiceLoader
.
load
(
CommandFactory
.
class
,
getClass
().
getClassLoader
()));
...
@@ -87,10 +86,12 @@ public class SpringZeroCli {
...
@@ -87,10 +86,12 @@ public class SpringZeroCli {
try
{
try
{
run
(
argsWithoutDebugFlags
);
run
(
argsWithoutDebugFlags
);
return
0
;
return
0
;
}
catch
(
NoArgumentsException
ex
)
{
}
catch
(
NoArgumentsException
ex
)
{
showUsage
();
showUsage
();
return
1
;
return
1
;
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
Set
<
SpringZeroCliException
.
Option
>
options
=
NO_EXCEPTION_OPTIONS
;
Set
<
SpringZeroCliException
.
Option
>
options
=
NO_EXCEPTION_OPTIONS
;
if
(
ex
instanceof
SpringZeroCliException
)
{
if
(
ex
instanceof
SpringZeroCliException
)
{
options
=
((
SpringZeroCliException
)
ex
).
getOptions
();
options
=
((
SpringZeroCliException
)
ex
).
getOptions
();
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/SpringZeroCliException.java
View file @
764a0a9a
...
@@ -70,8 +70,7 @@ public class SpringZeroCliException extends RuntimeException {
...
@@ -70,8 +70,7 @@ public class SpringZeroCliException extends RuntimeException {
}
}
/**
/**
* Returns options a set of options that are understood by the
* Returns options a set of options that are understood by the {@link SpringZeroCli}.
* {@link SpringZeroCli}.
*/
*/
public
Set
<
Option
>
getOptions
()
{
public
Set
<
Option
>
getOptions
()
{
return
Collections
.
unmodifiableSet
(
this
.
options
);
return
Collections
.
unmodifiableSet
(
this
.
options
);
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/command/CleanCommand.java
View file @
764a0a9a
...
@@ -29,7 +29,7 @@ import org.springframework.zero.cli.Command;
...
@@ -29,7 +29,7 @@ import org.springframework.zero.cli.Command;
/**
/**
* {@link Command} to 'clean' up grapes, removing cached dependencies and forcing a
* {@link Command} to 'clean' up grapes, removing cached dependencies and forcing a
* download on the next attempt to resolve.
* download on the next attempt to resolve.
*
*
* @author Dave Syer
* @author Dave Syer
*/
*/
public
class
CleanCommand
extends
OptionParsingCommand
{
public
class
CleanCommand
extends
OptionParsingCommand
{
...
@@ -102,7 +102,8 @@ public class CleanCommand extends OptionParsingCommand {
...
@@ -102,7 +102,8 @@ public class CleanCommand extends OptionParsingCommand {
||
group
.
equals
(
"org.springframework.zero"
))
{
||
group
.
equals
(
"org.springframework.zero"
))
{
System
.
out
.
println
(
"Deleting: "
+
file
);
System
.
out
.
println
(
"Deleting: "
+
file
);
FileUtil
.
forceDelete
(
file
);
FileUtil
.
forceDelete
(
file
);
}
else
{
}
else
{
for
(
Object
obj
:
FileUtil
.
listAll
(
file
,
Collections
.
emptyList
()))
{
for
(
Object
obj
:
FileUtil
.
listAll
(
file
,
Collections
.
emptyList
()))
{
File
candidate
=
(
File
)
obj
;
File
candidate
=
(
File
)
obj
;
if
(
candidate
.
getName
().
contains
(
"SNAPSHOT"
))
{
if
(
candidate
.
getName
().
contains
(
"SNAPSHOT"
))
{
...
@@ -119,7 +120,8 @@ public class CleanCommand extends OptionParsingCommand {
...
@@ -119,7 +120,8 @@ public class CleanCommand extends OptionParsingCommand {
File
parent
=
root
;
File
parent
=
root
;
if
(
layout
==
Layout
.
IVY
)
{
if
(
layout
==
Layout
.
IVY
)
{
parent
=
new
File
(
parent
,
group
);
parent
=
new
File
(
parent
,
group
);
}
else
{
}
else
{
for
(
String
path
:
group
.
split
(
"\\."
))
{
for
(
String
path
:
group
.
split
(
"\\."
))
{
parent
=
new
File
(
parent
,
path
);
parent
=
new
File
(
parent
,
path
);
}
}
...
@@ -140,7 +142,8 @@ public class CleanCommand extends OptionParsingCommand {
...
@@ -140,7 +142,8 @@ public class CleanCommand extends OptionParsingCommand {
if
(
dir
==
null
||
!
new
File
(
dir
).
exists
())
{
if
(
dir
==
null
||
!
new
File
(
dir
).
exists
())
{
dir
=
userdir
;
dir
=
userdir
;
home
=
new
File
(
dir
,
".groovy"
);
home
=
new
File
(
dir
,
".groovy"
);
}
else
{
}
else
{
home
=
new
File
(
dir
);
home
=
new
File
(
dir
);
}
}
if
(
dir
==
null
||
!
new
File
(
dir
).
exists
())
{
if
(
dir
==
null
||
!
new
File
(
dir
).
exists
())
{
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/command/OptionHandler.java
View file @
764a0a9a
...
@@ -77,7 +77,8 @@ public class OptionHandler {
...
@@ -77,7 +77,8 @@ public class OptionHandler {
OutputStream
out
=
new
ByteArrayOutputStream
();
OutputStream
out
=
new
ByteArrayOutputStream
();
try
{
try
{
getParser
().
printHelpOn
(
out
);
getParser
().
printHelpOn
(
out
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
return
"Help not available"
;
return
"Help not available"
;
}
}
return
out
.
toString
();
return
out
.
toString
();
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/command/ScriptCommand.java
View file @
764a0a9a
...
@@ -91,13 +91,17 @@ public class ScriptCommand implements Command {
...
@@ -91,13 +91,17 @@ public class ScriptCommand implements Command {
private
void
run
(
Object
main
,
String
[]
args
)
throws
Exception
{
private
void
run
(
Object
main
,
String
[]
args
)
throws
Exception
{
if
(
main
instanceof
Command
)
{
if
(
main
instanceof
Command
)
{
((
Command
)
main
).
run
(
args
);
((
Command
)
main
).
run
(
args
);
}
else
if
(
main
instanceof
OptionHandler
)
{
}
else
if
(
main
instanceof
OptionHandler
)
{
((
OptionHandler
)
getMain
()).
run
(
args
);
((
OptionHandler
)
getMain
()).
run
(
args
);
}
else
if
(
main
instanceof
Closure
)
{
}
else
if
(
main
instanceof
Closure
)
{
((
Closure
<?>)
main
).
call
((
Object
[])
args
);
((
Closure
<?>)
main
).
call
((
Object
[])
args
);
}
else
if
(
main
instanceof
Runnable
)
{
}
else
if
(
main
instanceof
Runnable
)
{
((
Runnable
)
main
).
run
();
((
Runnable
)
main
).
run
();
}
else
if
(
main
instanceof
Script
)
{
}
else
if
(
main
instanceof
Script
)
{
Script
script
=
(
Script
)
this
.
main
;
Script
script
=
(
Script
)
this
.
main
;
script
.
setProperty
(
"args"
,
args
);
script
.
setProperty
(
"args"
,
args
);
if
(
this
.
main
instanceof
GroovyObjectSupport
)
{
if
(
this
.
main
instanceof
GroovyObjectSupport
)
{
...
@@ -135,13 +139,15 @@ public class ScriptCommand implements Command {
...
@@ -135,13 +139,15 @@ public class ScriptCommand implements Command {
if
(
this
.
main
==
null
)
{
if
(
this
.
main
==
null
)
{
try
{
try
{
this
.
main
=
getMainClass
().
newInstance
();
this
.
main
=
getMainClass
().
newInstance
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
IllegalStateException
(
"Cannot create main class: "
+
this
.
name
,
throw
new
IllegalStateException
(
"Cannot create main class: "
+
this
.
name
,
e
);
e
);
}
}
if
(
this
.
main
instanceof
OptionHandler
)
{
if
(
this
.
main
instanceof
OptionHandler
)
{
((
OptionHandler
)
this
.
main
).
options
();
((
OptionHandler
)
this
.
main
).
options
();
}
else
if
(
this
.
main
instanceof
GroovyObjectSupport
)
{
}
else
if
(
this
.
main
instanceof
GroovyObjectSupport
)
{
GroovyObjectSupport
object
=
(
GroovyObjectSupport
)
this
.
main
;
GroovyObjectSupport
object
=
(
GroovyObjectSupport
)
this
.
main
;
MetaClass
metaClass
=
object
.
getMetaClass
();
MetaClass
metaClass
=
object
.
getMetaClass
();
MetaMethod
options
=
metaClass
.
getMetaMethod
(
"options"
,
null
);
MetaMethod
options
=
metaClass
.
getMetaMethod
(
"options"
,
null
);
...
@@ -160,9 +166,11 @@ public class ScriptCommand implements Command {
...
@@ -160,9 +166,11 @@ public class ScriptCommand implements Command {
Class
<?>[]
classes
;
Class
<?>[]
classes
;
try
{
try
{
classes
=
compiler
.
compile
(
source
);
classes
=
compiler
.
compile
(
source
);
}
catch
(
CompilationFailedException
e
)
{
}
catch
(
CompilationFailedException
e
)
{
throw
new
IllegalStateException
(
"Could not compile script"
,
e
);
throw
new
IllegalStateException
(
"Could not compile script"
,
e
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
IllegalStateException
(
"Could not compile script"
,
e
);
throw
new
IllegalStateException
(
"Could not compile script"
,
e
);
}
}
this
.
mainClass
=
classes
[
0
];
this
.
mainClass
=
classes
[
0
];
...
@@ -185,18 +193,21 @@ public class ScriptCommand implements Command {
...
@@ -185,18 +193,21 @@ public class ScriptCommand implements Command {
if
(
url
!=
null
)
{
if
(
url
!=
null
)
{
if
(
url
.
toString
().
startsWith
(
"file:"
))
{
if
(
url
.
toString
().
startsWith
(
"file:"
))
{
file
=
new
File
(
url
.
toString
().
substring
(
"file:"
.
length
()));
file
=
new
File
(
url
.
toString
().
substring
(
"file:"
.
length
()));
}
else
{
}
else
{
// probably in JAR file
// probably in JAR file
try
{
try
{
file
=
File
.
createTempFile
(
name
,
".groovy"
);
file
=
File
.
createTempFile
(
name
,
".groovy"
);
file
.
deleteOnExit
();
file
.
deleteOnExit
();
FileUtil
.
copy
(
url
,
file
,
null
);
FileUtil
.
copy
(
url
,
file
,
null
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
IllegalStateException
(
throw
new
IllegalStateException
(
"Could not create temp file for source: "
+
name
);
"Could not create temp file for source: "
+
name
);
}
}
}
}
}
else
{
}
else
{
String
home
=
System
.
getProperty
(
"SPRING_HOME"
,
System
.
getenv
(
"SPRING_HOME"
));
String
home
=
System
.
getProperty
(
"SPRING_HOME"
,
System
.
getenv
(
"SPRING_HOME"
));
if
(
home
==
null
)
{
if
(
home
==
null
)
{
home
=
"."
;
home
=
"."
;
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/DependencyCustomizer.java
View file @
764a0a9a
...
@@ -72,7 +72,8 @@ public class DependencyCustomizer {
...
@@ -72,7 +72,8 @@ public class DependencyCustomizer {
for
(
String
classname
:
classNames
)
{
for
(
String
classname
:
classNames
)
{
try
{
try
{
DependencyCustomizer
.
this
.
loader
.
loadClass
(
classname
);
DependencyCustomizer
.
this
.
loader
.
loadClass
(
classname
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
true
;
return
true
;
}
}
}
}
...
@@ -95,7 +96,8 @@ public class DependencyCustomizer {
...
@@ -95,7 +96,8 @@ public class DependencyCustomizer {
try
{
try
{
DependencyCustomizer
.
this
.
loader
.
loadClass
(
classname
);
DependencyCustomizer
.
this
.
loader
.
loadClass
(
classname
);
return
false
;
return
false
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
}
}
return
DependencyCustomizer
.
this
.
canAdd
();
return
DependencyCustomizer
.
this
.
canAdd
();
...
@@ -119,7 +121,8 @@ public class DependencyCustomizer {
...
@@ -119,7 +121,8 @@ public class DependencyCustomizer {
return
false
;
return
false
;
}
}
return
true
;
return
true
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
}
}
return
DependencyCustomizer
.
this
.
canAdd
();
return
DependencyCustomizer
.
this
.
canAdd
();
...
@@ -143,7 +146,8 @@ public class DependencyCustomizer {
...
@@ -143,7 +146,8 @@ public class DependencyCustomizer {
return
true
;
return
true
;
}
}
return
false
;
return
false
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
}
}
return
DependencyCustomizer
.
this
.
canAdd
();
return
DependencyCustomizer
.
this
.
canAdd
();
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/GroovyCompiler.java
View file @
764a0a9a
...
@@ -47,13 +47,13 @@ import org.codehaus.groovy.control.customizers.ImportCustomizer;
...
@@ -47,13 +47,13 @@ import org.codehaus.groovy.control.customizers.ImportCustomizer;
* <li>{@link CompilerAutoConfiguration} strategies will be read from
* <li>{@link CompilerAutoConfiguration} strategies will be read from
* <code>META-INF/services/org.springframework.zero.cli.compiler.CompilerAutoConfiguration</code>
* <code>META-INF/services/org.springframework.zero.cli.compiler.CompilerAutoConfiguration</code>
* (per the standard java {@link ServiceLoader} contract) and applied during compilation</li>
* (per the standard java {@link ServiceLoader} contract) and applied during compilation</li>
*
*
* <li>Multiple classes can be returned if the Groovy source defines more than one Class</li>
* <li>Multiple classes can be returned if the Groovy source defines more than one Class</li>
*
*
* <li>Generated class files can also be loaded using
* <li>Generated class files can also be loaded using
* {@link ClassLoader#getResource(String)}</li>
* {@link ClassLoader#getResource(String)}</li>
* <ul>
* <ul>
*
*
* @author Phillip Webb
* @author Phillip Webb
* @author Dave Syer
* @author Dave Syer
*/
*/
...
@@ -88,7 +88,8 @@ public class GroovyCompiler {
...
@@ -88,7 +88,8 @@ public class GroovyCompiler {
for
(
File
file
:
files
)
{
for
(
File
file
:
files
)
{
if
(
file
.
getName
().
endsWith
(
".groovy"
)
||
file
.
getName
().
endsWith
(
".java"
))
{
if
(
file
.
getName
().
endsWith
(
".groovy"
)
||
file
.
getName
().
endsWith
(
".java"
))
{
compilables
.
add
(
file
);
compilables
.
add
(
file
);
}
else
{
}
else
{
others
.
add
(
file
);
others
.
add
(
file
);
}
}
}
}
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java
View file @
764a0a9a
...
@@ -24,7 +24,7 @@ import org.springframework.zero.cli.compiler.DependencyCustomizer;
...
@@ -24,7 +24,7 @@ import org.springframework.zero.cli.compiler.DependencyCustomizer;
/**
/**
* {@link CompilerAutoConfiguration} for Spring MVC.
* {@link CompilerAutoConfiguration} for Spring MVC.
*
*
* @author Dave Syer
* @author Dave Syer
* @author Phillip Webb
* @author Phillip Webb
*/
*/
...
@@ -58,8 +58,8 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio
...
@@ -58,8 +58,8 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio
imports
.
addStarImports
(
"org.springframework.web.bind.annotation"
,
imports
.
addStarImports
(
"org.springframework.web.bind.annotation"
,
"org.springframework.web.servlet.config.annotation"
,
"org.springframework.web.servlet.config.annotation"
,
"org.springframework.http"
);
"org.springframework.http"
);
imports
.
addStaticImport
(
imports
.
addStaticImport
(
"org.springframework.zero.cli.template.GroovyTemplate"
,
"
org.springframework.zero.cli.template.GroovyTemplate"
,
"
template"
);
"template"
);
}
}
}
}
spring-zero-cli/src/main/java/org/springframework/zero/cli/compiler/autoconfigure/SpringZeroCompilerAutoConfiguration.java
View file @
764a0a9a
...
@@ -100,7 +100,8 @@ public class SpringZeroCompilerAutoConfiguration extends CompilerAutoConfigurati
...
@@ -100,7 +100,8 @@ public class SpringZeroCompilerAutoConfiguration extends CompilerAutoConfigurati
AnnotationNode
annotationNode
=
new
AnnotationNode
(
new
ClassNode
(
AnnotationNode
annotationNode
=
new
AnnotationNode
(
new
ClassNode
(
annotationClass
));
annotationClass
));
classNode
.
addAnnotation
(
annotationNode
);
classNode
.
addAnnotation
(
annotationNode
);
}
catch
(
ClassNotFoundException
e
)
{
}
catch
(
ClassNotFoundException
e
)
{
throw
new
IllegalStateException
(
e
);
throw
new
IllegalStateException
(
e
);
}
}
}
}
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/runner/SpringZeroRunner.java
View file @
764a0a9a
...
@@ -92,10 +92,12 @@ public class SpringZeroRunner {
...
@@ -92,10 +92,12 @@ public class SpringZeroRunner {
this
.
fileWatchThread
.
start
();
this
.
fileWatchThread
.
start
();
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
if
(
this
.
fileWatchThread
==
null
)
{
if
(
this
.
fileWatchThread
==
null
)
{
throw
ex
;
throw
ex
;
}
else
{
}
else
{
ex
.
printStackTrace
();
ex
.
printStackTrace
();
}
}
}
}
...
@@ -132,7 +134,8 @@ public class SpringZeroRunner {
...
@@ -132,7 +134,8 @@ public class SpringZeroRunner {
String
[].
class
);
String
[].
class
);
this
.
applicationContext
=
method
.
invoke
(
null
,
this
.
sources
,
this
.
applicationContext
=
method
.
invoke
(
null
,
this
.
sources
,
SpringZeroRunner
.
this
.
args
);
SpringZeroRunner
.
this
.
args
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
ex
.
printStackTrace
();
}
}
}
}
...
@@ -145,11 +148,14 @@ public class SpringZeroRunner {
...
@@ -145,11 +148,14 @@ public class SpringZeroRunner {
try
{
try
{
Method
method
=
this
.
applicationContext
.
getClass
().
getMethod
(
"close"
);
Method
method
=
this
.
applicationContext
.
getClass
().
getMethod
(
"close"
);
method
.
invoke
(
this
.
applicationContext
);
method
.
invoke
(
this
.
applicationContext
);
}
catch
(
NoSuchMethodException
ex
)
{
}
catch
(
NoSuchMethodException
ex
)
{
// Not an application context that we can close
// Not an application context that we can close
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
ex
.
printStackTrace
();
}
finally
{
}
finally
{
this
.
applicationContext
=
null
;
this
.
applicationContext
=
null
;
}
}
}
}
...
@@ -186,9 +192,11 @@ public class SpringZeroRunner {
...
@@ -186,9 +192,11 @@ public class SpringZeroRunner {
compileAndRun
();
compileAndRun
();
}
}
}
}
}
catch
(
InterruptedException
ex
)
{
}
catch
(
InterruptedException
ex
)
{
Thread
.
currentThread
().
interrupt
();
Thread
.
currentThread
().
interrupt
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
// Swallow, will be reported by compileAndRun
// Swallow, will be reported by compileAndRun
}
}
}
}
...
...
spring-zero-cli/src/main/java/org/springframework/zero/cli/template/GroovyTemplate.java
View file @
764a0a9a
...
@@ -48,10 +48,12 @@ public class GroovyTemplate {
...
@@ -48,10 +48,12 @@ public class GroovyTemplate {
Template
template
;
Template
template
;
if
(
file
.
exists
())
{
if
(
file
.
exists
())
{
template
=
engine
.
createTemplate
(
file
);
template
=
engine
.
createTemplate
(
file
);
}
else
{
}
else
{
if
(
resource
!=
null
)
{
if
(
resource
!=
null
)
{
template
=
engine
.
createTemplate
(
resource
);
template
=
engine
.
createTemplate
(
resource
);
}
else
{
}
else
{
template
=
engine
.
createTemplate
(
name
);
template
=
engine
.
createTemplate
(
name
);
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/BeanDefinitionLoader.java
View file @
764a0a9a
...
@@ -138,7 +138,8 @@ class BeanDefinitionLoader {
...
@@ -138,7 +138,8 @@ class BeanDefinitionLoader {
if
(
source
instanceof
CharSequence
)
{
if
(
source
instanceof
CharSequence
)
{
try
{
try
{
return
load
(
Class
.
forName
(
source
.
toString
()));
return
load
(
Class
.
forName
(
source
.
toString
()));
}
catch
(
ClassNotFoundException
e
)
{
}
catch
(
ClassNotFoundException
e
)
{
}
}
Resource
loadedResource
=
(
this
.
resourceLoader
!=
null
?
this
.
resourceLoader
Resource
loadedResource
=
(
this
.
resourceLoader
!=
null
?
this
.
resourceLoader
...
...
spring-zero-core/src/main/java/org/springframework/zero/SpringApplication.java
View file @
764a0a9a
...
@@ -270,7 +270,8 @@ public class SpringApplication {
...
@@ -270,7 +270,8 @@ public class SpringApplication {
contextClass
=
Class
contextClass
=
Class
.
forName
(
this
.
webEnvironment
?
DEFAULT_WEB_CONTEXT_CLASS
.
forName
(
this
.
webEnvironment
?
DEFAULT_WEB_CONTEXT_CLASS
:
DEFAULT_CONTEXT_CLASS
);
:
DEFAULT_CONTEXT_CLASS
);
}
catch
(
ClassNotFoundException
ex
)
{
}
catch
(
ClassNotFoundException
ex
)
{
throw
new
IllegalStateException
(
throw
new
IllegalStateException
(
"Unable create a default ApplicationContext, "
"Unable create a default ApplicationContext, "
+
"please specify an ApplicationContextClass"
,
ex
);
+
"please specify an ApplicationContextClass"
,
ex
);
...
@@ -344,14 +345,16 @@ public class SpringApplication {
...
@@ -344,14 +345,16 @@ public class SpringApplication {
for
(
String
arg
:
defaults
)
{
for
(
String
arg
:
defaults
)
{
if
(
isOptionArg
(
arg
))
{
if
(
isOptionArg
(
arg
))
{
addOptionArg
(
options
,
arg
);
addOptionArg
(
options
,
arg
);
}
else
{
}
else
{
nonopts
.
add
(
arg
);
nonopts
.
add
(
arg
);
}
}
}
}
for
(
String
arg
:
args
)
{
for
(
String
arg
:
args
)
{
if
(
isOptionArg
(
arg
))
{
if
(
isOptionArg
(
arg
))
{
addOptionArg
(
options
,
arg
);
addOptionArg
(
options
,
arg
);
}
else
if
(!
nonopts
.
contains
(
arg
))
{
}
else
if
(!
nonopts
.
contains
(
arg
))
{
nonopts
.
add
(
arg
);
nonopts
.
add
(
arg
);
}
}
}
}
...
@@ -376,7 +379,8 @@ public class SpringApplication {
...
@@ -376,7 +379,8 @@ public class SpringApplication {
optionName
=
optionText
.
substring
(
0
,
optionText
.
indexOf
(
"="
));
optionName
=
optionText
.
substring
(
0
,
optionText
.
indexOf
(
"="
));
optionValue
=
optionText
.
substring
(
optionText
.
indexOf
(
"="
)
+
1
,
optionValue
=
optionText
.
substring
(
optionText
.
indexOf
(
"="
)
+
1
,
optionText
.
length
());
optionText
.
length
());
}
else
{
}
else
{
optionName
=
optionText
;
optionName
=
optionText
;
}
}
if
(
optionName
.
isEmpty
())
{
if
(
optionName
.
isEmpty
())
{
...
@@ -434,7 +438,8 @@ public class SpringApplication {
...
@@ -434,7 +438,8 @@ public class SpringApplication {
for
(
CommandLineRunner
runner
:
runners
)
{
for
(
CommandLineRunner
runner
:
runners
)
{
try
{
try
{
runner
.
run
(
args
);
runner
.
run
(
args
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
IllegalStateException
(
"Failed to execute CommandLineRunner"
,
e
);
throw
new
IllegalStateException
(
"Failed to execute CommandLineRunner"
,
e
);
}
}
}
}
...
@@ -606,11 +611,13 @@ public class SpringApplication {
...
@@ -606,11 +611,13 @@ public class SpringApplication {
generators
.
addAll
(
context
.
getBeansOfType
(
ExitCodeGenerator
.
class
)
generators
.
addAll
(
context
.
getBeansOfType
(
ExitCodeGenerator
.
class
)
.
values
());
.
values
());
exitCode
=
getExitCode
(
generators
);
exitCode
=
getExitCode
(
generators
);
}
finally
{
}
finally
{
close
(
context
);
close
(
context
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
exitCode
=
(
exitCode
==
0
?
1
:
exitCode
);
exitCode
=
(
exitCode
==
0
?
1
:
exitCode
);
}
}
...
@@ -625,7 +632,8 @@ public class SpringApplication {
...
@@ -625,7 +632,8 @@ public class SpringApplication {
if
(
value
>
0
&&
value
>
exitCode
||
value
<
0
&&
value
<
exitCode
)
{
if
(
value
>
0
&&
value
>
exitCode
||
value
<
0
&&
value
<
exitCode
)
{
exitCode
=
value
;
exitCode
=
value
;
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
exitCode
=
(
exitCode
==
0
?
1
:
exitCode
);
exitCode
=
(
exitCode
==
0
?
1
:
exitCode
);
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/bind/CustomPropertyConstructor.java
View file @
764a0a9a
...
@@ -74,7 +74,8 @@ public class CustomPropertyConstructor extends Constructor {
...
@@ -74,7 +74,8 @@ public class CustomPropertyConstructor extends Constructor {
try
{
try
{
typeMap
.
put
(
alias
,
this
.
propertyUtils
.
getProperty
(
type
,
name
));
typeMap
.
put
(
alias
,
this
.
propertyUtils
.
getProperty
(
type
,
name
));
}
catch
(
IntrospectionException
e
)
{
}
catch
(
IntrospectionException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/bind/InetAddressEditor.java
View file @
764a0a9a
...
@@ -37,7 +37,8 @@ public class InetAddressEditor extends PropertyEditorSupport implements Property
...
@@ -37,7 +37,8 @@ public class InetAddressEditor extends PropertyEditorSupport implements Property
public
void
setAsText
(
String
text
)
throws
IllegalArgumentException
{
public
void
setAsText
(
String
text
)
throws
IllegalArgumentException
{
try
{
try
{
setValue
(
InetAddress
.
getByName
(
text
));
setValue
(
InetAddress
.
getByName
(
text
));
}
catch
(
UnknownHostException
e
)
{
}
catch
(
UnknownHostException
e
)
{
throw
new
IllegalArgumentException
(
"Cannot locate host"
,
e
);
throw
new
IllegalArgumentException
(
"Cannot locate host"
,
e
);
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/bind/PropertiesConfigurationFactory.java
View file @
764a0a9a
...
@@ -172,7 +172,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
...
@@ -172,7 +172,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
try
{
try
{
if
(
this
.
properties
!=
null
)
{
if
(
this
.
properties
!=
null
)
{
logger
.
trace
(
"Properties:\n"
+
this
.
properties
);
logger
.
trace
(
"Properties:\n"
+
this
.
properties
);
}
else
{
}
else
{
logger
.
trace
(
"Property Sources: "
+
this
.
propertySources
);
logger
.
trace
(
"Property Sources: "
+
this
.
propertySources
);
}
}
this
.
initialized
=
true
;
this
.
initialized
=
true
;
...
@@ -180,7 +181,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
...
@@ -180,7 +181,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
RelaxedDataBinder
dataBinder
;
RelaxedDataBinder
dataBinder
;
if
(
this
.
targetName
!=
null
)
{
if
(
this
.
targetName
!=
null
)
{
dataBinder
=
new
RelaxedDataBinder
(
this
.
configuration
,
this
.
targetName
);
dataBinder
=
new
RelaxedDataBinder
(
this
.
configuration
,
this
.
targetName
);
}
else
{
}
else
{
dataBinder
=
new
RelaxedDataBinder
(
this
.
configuration
);
dataBinder
=
new
RelaxedDataBinder
(
this
.
configuration
);
}
}
if
(
this
.
validator
!=
null
)
{
if
(
this
.
validator
!=
null
)
{
...
@@ -195,7 +197,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
...
@@ -195,7 +197,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
PropertyValues
pvs
;
PropertyValues
pvs
;
if
(
this
.
properties
!=
null
)
{
if
(
this
.
properties
!=
null
)
{
pvs
=
new
MutablePropertyValues
(
this
.
properties
);
pvs
=
new
MutablePropertyValues
(
this
.
properties
);
}
else
{
}
else
{
pvs
=
new
PropertySourcesPropertyValues
(
this
.
propertySources
);
pvs
=
new
PropertySourcesPropertyValues
(
this
.
propertySources
);
}
}
dataBinder
.
bind
(
pvs
);
dataBinder
.
bind
(
pvs
);
...
@@ -219,7 +222,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
...
@@ -219,7 +222,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
}
}
}
}
}
}
}
catch
(
BindException
e
)
{
}
catch
(
BindException
e
)
{
if
(
this
.
exceptionIfInvalid
)
{
if
(
this
.
exceptionIfInvalid
)
{
throw
e
;
throw
e
;
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/bind/PropertySourcesPropertyValues.java
View file @
764a0a9a
...
@@ -98,7 +98,8 @@ public class PropertySourcesPropertyValues implements PropertyValues {
...
@@ -98,7 +98,8 @@ public class PropertySourcesPropertyValues implements PropertyValues {
PropertyValue
pvOld
=
old
.
getPropertyValue
(
newPv
.
getName
());
PropertyValue
pvOld
=
old
.
getPropertyValue
(
newPv
.
getName
());
if
(
pvOld
==
null
)
{
if
(
pvOld
==
null
)
{
changes
.
addPropertyValue
(
newPv
);
changes
.
addPropertyValue
(
newPv
);
}
else
if
(!
pvOld
.
equals
(
newPv
))
{
}
else
if
(!
pvOld
.
equals
(
newPv
))
{
// it's changed
// it's changed
changes
.
addPropertyValue
(
newPv
);
changes
.
addPropertyValue
(
newPv
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/bind/RelaxedDataBinder.java
View file @
764a0a9a
...
@@ -157,7 +157,8 @@ public class RelaxedDataBinder extends DataBinder {
...
@@ -157,7 +157,8 @@ public class RelaxedDataBinder extends DataBinder {
Map
<
String
,
Object
>
existing
=
(
Map
<
String
,
Object
>)
target
Map
<
String
,
Object
>
existing
=
(
Map
<
String
,
Object
>)
target
.
getPropertyValue
(
base
);
.
getPropertyValue
(
base
);
nested
=
existing
;
nested
=
existing
;
}
else
{
}
else
{
target
.
setPropertyValue
(
base
,
nested
);
target
.
setPropertyValue
(
base
,
nested
);
}
}
modifyPopertiesForMap
(
nested
,
propertyValues
,
index
,
base
);
modifyPopertiesForMap
(
nested
,
propertyValues
,
index
,
base
);
...
@@ -196,7 +197,8 @@ public class RelaxedDataBinder extends DataBinder {
...
@@ -196,7 +197,8 @@ public class RelaxedDataBinder extends DataBinder {
if
(
target
.
getPropertyType
(
prefix
+
candidate
)
!=
null
)
{
if
(
target
.
getPropertyType
(
prefix
+
candidate
)
!=
null
)
{
return
candidate
;
return
candidate
;
}
}
}
catch
(
InvalidPropertyException
ex
)
{
}
catch
(
InvalidPropertyException
ex
)
{
}
}
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/bind/YamlConfigurationFactory.java
View file @
764a0a9a
...
@@ -158,7 +158,8 @@ public class YamlConfigurationFactory<T> implements FactoryBean<T>, MessageSourc
...
@@ -158,7 +158,8 @@ public class YamlConfigurationFactory<T> implements FactoryBean<T>, MessageSourc
}
}
}
}
}
}
}
catch
(
YAMLException
e
)
{
}
catch
(
YAMLException
e
)
{
if
(
this
.
exceptionIfInvalid
)
{
if
(
this
.
exceptionIfInvalid
)
{
throw
e
;
throw
e
;
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/config/JacksonJsonParser.java
View file @
764a0a9a
...
@@ -34,7 +34,8 @@ public class JacksonJsonParser implements JsonParser {
...
@@ -34,7 +34,8 @@ public class JacksonJsonParser implements JsonParser {
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
Object
>
map
=
new
ObjectMapper
().
readValue
(
json
,
Map
.
class
);
Map
<
String
,
Object
>
map
=
new
ObjectMapper
().
readValue
(
json
,
Map
.
class
);
return
map
;
return
map
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
IllegalArgumentException
(
"Cannot parse JSON"
,
e
);
throw
new
IllegalArgumentException
(
"Cannot parse JSON"
,
e
);
}
}
}
}
...
@@ -45,7 +46,8 @@ public class JacksonJsonParser implements JsonParser {
...
@@ -45,7 +46,8 @@ public class JacksonJsonParser implements JsonParser {
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
List
<
Object
>
list
=
new
ObjectMapper
().
readValue
(
json
,
List
.
class
);
List
<
Object
>
list
=
new
ObjectMapper
().
readValue
(
json
,
List
.
class
);
return
list
;
return
list
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
IllegalArgumentException
(
"Cannot parse JSON"
,
e
);
throw
new
IllegalArgumentException
(
"Cannot parse JSON"
,
e
);
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/config/SimpleJsonParser.java
View file @
764a0a9a
...
@@ -39,7 +39,8 @@ public class SimpleJsonParser implements JsonParser {
...
@@ -39,7 +39,8 @@ public class SimpleJsonParser implements JsonParser {
public
Map
<
String
,
Object
>
parseMap
(
String
json
)
{
public
Map
<
String
,
Object
>
parseMap
(
String
json
)
{
if
(
json
.
startsWith
(
"{"
))
{
if
(
json
.
startsWith
(
"{"
))
{
return
parseMapInternal
(
json
);
return
parseMapInternal
(
json
);
}
else
if
(
json
.
trim
().
equals
(
""
))
{
}
else
if
(
json
.
trim
().
equals
(
""
))
{
return
new
HashMap
<
String
,
Object
>();
return
new
HashMap
<
String
,
Object
>();
}
}
return
null
;
return
null
;
...
@@ -49,7 +50,8 @@ public class SimpleJsonParser implements JsonParser {
...
@@ -49,7 +50,8 @@ public class SimpleJsonParser implements JsonParser {
public
List
<
Object
>
parseList
(
String
json
)
{
public
List
<
Object
>
parseList
(
String
json
)
{
if
(
json
.
startsWith
(
"["
))
{
if
(
json
.
startsWith
(
"["
))
{
return
parseListInternal
(
json
);
return
parseListInternal
(
json
);
}
else
if
(
json
.
trim
().
equals
(
""
))
{
}
else
if
(
json
.
trim
().
equals
(
""
))
{
return
new
ArrayList
<
Object
>();
return
new
ArrayList
<
Object
>();
}
}
return
null
;
return
null
;
...
@@ -104,7 +106,8 @@ public class SimpleJsonParser implements JsonParser {
...
@@ -104,7 +106,8 @@ public class SimpleJsonParser implements JsonParser {
trimTrailingCharacter
(
values
[
1
],
'"'
),
'"'
);
trimTrailingCharacter
(
values
[
1
],
'"'
),
'"'
);
if
(
string
.
startsWith
(
"{"
)
&&
string
.
endsWith
(
"}"
))
{
if
(
string
.
startsWith
(
"{"
)
&&
string
.
endsWith
(
"}"
))
{
value
=
parseInternal
(
string
);
value
=
parseInternal
(
string
);
}
else
{
}
else
{
value
=
string
;
value
=
string
;
}
}
}
}
...
@@ -129,7 +132,8 @@ public class SimpleJsonParser implements JsonParser {
...
@@ -129,7 +132,8 @@ public class SimpleJsonParser implements JsonParser {
if
(
current
==
','
&&
inObject
==
0
)
{
if
(
current
==
','
&&
inObject
==
0
)
{
list
.
add
(
build
.
toString
());
list
.
add
(
build
.
toString
());
build
.
setLength
(
0
);
build
.
setLength
(
0
);
}
else
{
}
else
{
build
.
append
(
current
);
build
.
append
(
current
);
}
}
index
++;
index
++;
...
...
spring-zero-core/src/main/java/org/springframework/zero/config/YamlMapFactoryBean.java
View file @
764a0a9a
...
@@ -99,7 +99,8 @@ public class YamlMapFactoryBean extends YamlProcessor implements
...
@@ -99,7 +99,8 @@ public class YamlMapFactoryBean extends YamlProcessor implements
(
Map
)
existing
);
(
Map
)
existing
);
merge
(
result
,
(
Map
)
value
);
merge
(
result
,
(
Map
)
value
);
output
.
put
(
key
,
result
);
output
.
put
(
key
,
result
);
}
else
{
}
else
{
output
.
put
(
key
,
value
);
output
.
put
(
key
,
value
);
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/config/YamlProcessor.java
View file @
764a0a9a
...
@@ -179,14 +179,16 @@ public class YamlProcessor {
...
@@ -179,14 +179,16 @@ public class YamlProcessor {
// No need to load any more resources
// No need to load any more resources
break
;
break
;
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
if
(
this
.
resolutionMethod
==
ResolutionMethod
.
FIRST_FOUND
if
(
this
.
resolutionMethod
==
ResolutionMethod
.
FIRST_FOUND
||
this
.
resolutionMethod
==
ResolutionMethod
.
OVERRIDE_AND_IGNORE
)
{
||
this
.
resolutionMethod
==
ResolutionMethod
.
OVERRIDE_AND_IGNORE
)
{
if
(
logger
.
isWarnEnabled
())
{
if
(
logger
.
isWarnEnabled
())
{
logger
.
warn
(
"Could not load map from "
+
resource
+
": "
logger
.
warn
(
"Could not load map from "
+
resource
+
": "
+
e
.
getMessage
());
+
e
.
getMessage
());
}
}
}
else
{
}
else
{
throw
new
IllegalStateException
(
e
);
throw
new
IllegalStateException
(
e
);
}
}
}
}
...
@@ -199,7 +201,8 @@ public class YamlProcessor {
...
@@ -199,7 +201,8 @@ public class YamlProcessor {
if
(
this
.
documentMatchers
.
isEmpty
())
{
if
(
this
.
documentMatchers
.
isEmpty
())
{
logger
.
debug
(
"Merging document (no matchers set)"
+
map
);
logger
.
debug
(
"Merging document (no matchers set)"
+
map
);
callback
.
process
(
properties
,
map
);
callback
.
process
(
properties
,
map
);
}
else
{
}
else
{
boolean
valueFound
=
false
;
boolean
valueFound
=
false
;
MatchStatus
result
=
MatchStatus
.
ABSTAIN
;
MatchStatus
result
=
MatchStatus
.
ABSTAIN
;
for
(
DocumentMatcher
matcher
:
this
.
documentMatchers
)
{
for
(
DocumentMatcher
matcher
:
this
.
documentMatchers
)
{
...
@@ -216,7 +219,8 @@ public class YamlProcessor {
...
@@ -216,7 +219,8 @@ public class YamlProcessor {
if
(
result
==
MatchStatus
.
ABSTAIN
&&
this
.
matchDefault
)
{
if
(
result
==
MatchStatus
.
ABSTAIN
&&
this
.
matchDefault
)
{
logger
.
debug
(
"Matched document with default matcher: "
+
map
);
logger
.
debug
(
"Matched document with default matcher: "
+
map
);
callback
.
process
(
properties
,
map
);
callback
.
process
(
properties
,
map
);
}
else
if
(!
valueFound
)
{
}
else
if
(!
valueFound
)
{
logger
.
debug
(
"Unmatched document"
);
logger
.
debug
(
"Unmatched document"
);
return
false
;
return
false
;
}
}
...
@@ -231,19 +235,22 @@ public class YamlProcessor {
...
@@ -231,19 +235,22 @@ public class YamlProcessor {
if
(
StringUtils
.
hasText
(
path
))
{
if
(
StringUtils
.
hasText
(
path
))
{
if
(
key
.
startsWith
(
"["
))
{
if
(
key
.
startsWith
(
"["
))
{
key
=
path
+
key
;
key
=
path
+
key
;
}
else
{
}
else
{
key
=
path
+
"."
+
key
;
key
=
path
+
"."
+
key
;
}
}
}
}
Object
value
=
entry
.
getValue
();
Object
value
=
entry
.
getValue
();
if
(
value
instanceof
String
)
{
if
(
value
instanceof
String
)
{
properties
.
put
(
key
,
value
);
properties
.
put
(
key
,
value
);
}
else
if
(
value
instanceof
Map
)
{
}
else
if
(
value
instanceof
Map
)
{
// Need a compound key
// Need a compound key
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
value
;
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
value
;
assignProperties
(
properties
,
map
,
key
);
assignProperties
(
properties
,
map
,
key
);
}
else
if
(
value
instanceof
Collection
)
{
}
else
if
(
value
instanceof
Collection
)
{
// Need a compound key
// Need a compound key
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
Collection
<
Object
>
collection
=
(
Collection
<
Object
>)
value
;
Collection
<
Object
>
collection
=
(
Collection
<
Object
>)
value
;
...
@@ -254,7 +261,8 @@ public class YamlProcessor {
...
@@ -254,7 +261,8 @@ public class YamlProcessor {
assignProperties
(
properties
,
assignProperties
(
properties
,
Collections
.
singletonMap
(
"["
+
(
count
++)
+
"]"
,
object
),
key
);
Collections
.
singletonMap
(
"["
+
(
count
++)
+
"]"
,
object
),
key
);
}
}
}
else
{
}
else
{
properties
.
put
(
key
,
value
==
null
?
""
:
value
);
properties
.
put
(
key
,
value
==
null
?
""
:
value
);
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/annotation/AbstractOnBeanCondition.java
View file @
764a0a9a
...
@@ -78,7 +78,8 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition {
...
@@ -78,7 +78,8 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition {
}
}
}
}
});
});
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
}
}
}
}
...
@@ -116,7 +117,8 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition {
...
@@ -116,7 +117,8 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition {
if
(
beans
.
length
!=
0
)
{
if
(
beans
.
length
!=
0
)
{
beanClassesFound
.
add
(
beanClass
);
beanClassesFound
.
add
(
beanClass
);
}
}
}
catch
(
ClassNotFoundException
ex
)
{
}
catch
(
ClassNotFoundException
ex
)
{
}
}
}
}
for
(
String
beanName
:
beanNames
)
{
for
(
String
beanName
:
beanNames
)
{
...
@@ -142,7 +144,8 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition {
...
@@ -142,7 +144,8 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition {
+
candidates
);
+
candidates
);
if
(
found
.
isEmpty
())
{
if
(
found
.
isEmpty
())
{
this
.
logger
.
debug
(
prefix
+
"Found no beans"
);
this
.
logger
.
debug
(
prefix
+
"Found no beans"
);
}
else
{
}
else
{
this
.
logger
.
debug
(
prefix
+
"Found beans with "
+
type
+
": "
+
found
);
this
.
logger
.
debug
(
prefix
+
"Found beans with "
+
type
+
": "
+
found
);
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/annotation/ConfigurationPropertiesBindingConfiguration.java
View file @
764a0a9a
...
@@ -77,10 +77,12 @@ public class ConfigurationPropertiesBindingConfiguration {
...
@@ -77,10 +77,12 @@ public class ConfigurationPropertiesBindingConfiguration {
if
(
this
.
configurer
!=
null
)
{
if
(
this
.
configurer
!=
null
)
{
propertySources
=
extractPropertySources
(
this
.
configurer
);
propertySources
=
extractPropertySources
(
this
.
configurer
);
}
else
if
(
this
.
environment
instanceof
ConfigurableEnvironment
)
{
}
else
if
(
this
.
environment
instanceof
ConfigurableEnvironment
)
{
propertySources
=
flattenPropertySources
(((
ConfigurableEnvironment
)
this
.
environment
)
propertySources
=
flattenPropertySources
(((
ConfigurableEnvironment
)
this
.
environment
)
.
getPropertySources
());
.
getPropertySources
());
}
else
{
}
else
{
// empty, so not very useful, but fulfils the contract
// empty, so not very useful, but fulfils the contract
propertySources
=
new
MutablePropertySources
();
propertySources
=
new
MutablePropertySources
();
}
}
...
@@ -121,7 +123,8 @@ public class ConfigurationPropertiesBindingConfiguration {
...
@@ -121,7 +123,8 @@ public class ConfigurationPropertiesBindingConfiguration {
for
(
PropertySource
<?>
childSource
:
environment
.
getPropertySources
())
{
for
(
PropertySource
<?>
childSource
:
environment
.
getPropertySources
())
{
flattenPropertySources
(
childSource
,
result
);
flattenPropertySources
(
childSource
,
result
);
}
}
}
else
{
}
else
{
result
.
addLast
(
propertySource
);
result
.
addLast
(
propertySource
);
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/annotation/PropertySourcesBindingPostProcessor.java
View file @
764a0a9a
...
@@ -113,9 +113,11 @@ public class PropertySourcesBindingPostProcessor implements BeanPostProcessor,
...
@@ -113,9 +113,11 @@ public class PropertySourcesBindingPostProcessor implements BeanPostProcessor,
factory
.
setTargetName
(
targetName
);
factory
.
setTargetName
(
targetName
);
try
{
try
{
target
=
factory
.
getObject
();
// throwaway
target
=
factory
.
getObject
();
// throwaway
}
catch
(
BeansException
e
)
{
}
catch
(
BeansException
e
)
{
throw
e
;
throw
e
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
BeanCreationException
(
beanName
,
"Could not bind"
,
e
);
throw
new
BeanCreationException
(
beanName
,
"Could not bind"
,
e
);
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/AbstractEmbeddedServletContainerFactory.java
View file @
764a0a9a
...
@@ -378,7 +378,8 @@ public abstract class AbstractEmbeddedServletContainerFactory implements
...
@@ -378,7 +378,8 @@ public abstract class AbstractEmbeddedServletContainerFactory implements
path
=
path
.
substring
(
0
,
path
.
indexOf
(
"!/"
));
path
=
path
.
substring
(
0
,
path
.
indexOf
(
"!/"
));
}
}
return
new
File
(
path
);
return
new
File
(
path
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
return
null
;
return
null
;
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/EmbeddedWebApplicationContext.java
View file @
764a0a9a
...
@@ -131,10 +131,12 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
...
@@ -131,10 +131,12 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
EmbeddedServletContainerFactory
containerFactory
=
getEmbeddedServletContainerFactory
();
EmbeddedServletContainerFactory
containerFactory
=
getEmbeddedServletContainerFactory
();
this
.
embeddedServletContainer
=
containerFactory
this
.
embeddedServletContainer
=
containerFactory
.
getEmbeddedServletContainer
(
getSelfInitializer
());
.
getEmbeddedServletContainer
(
getSelfInitializer
());
}
else
if
(
getServletContext
()
!=
null
)
{
}
else
if
(
getServletContext
()
!=
null
)
{
try
{
try
{
getSelfInitializer
().
onStartup
(
getServletContext
());
getSelfInitializer
().
onStartup
(
getServletContext
());
}
catch
(
ServletException
e
)
{
}
catch
(
ServletException
e
)
{
throw
new
ApplicationContextException
(
throw
new
ApplicationContextException
(
"Cannot initialize servlet context"
,
e
);
"Cannot initialize servlet context"
,
e
);
}
}
...
@@ -280,12 +282,14 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
...
@@ -280,12 +282,14 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
logger
.
info
(
"Root WebApplicationContext: initialization completed in "
logger
.
info
(
"Root WebApplicationContext: initialization completed in "
+
elapsedTime
+
" ms"
);
+
elapsedTime
+
" ms"
);
}
}
}
catch
(
RuntimeException
ex
)
{
}
catch
(
RuntimeException
ex
)
{
logger
.
error
(
"Context initialization failed"
,
ex
);
logger
.
error
(
"Context initialization failed"
,
ex
);
servletContext
.
setAttribute
(
servletContext
.
setAttribute
(
WebApplicationContext
.
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
,
ex
);
WebApplicationContext
.
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
,
ex
);
throw
ex
;
throw
ex
;
}
catch
(
Error
err
)
{
}
catch
(
Error
err
)
{
logger
.
error
(
"Context initialization failed"
,
err
);
logger
.
error
(
"Context initialization failed"
,
err
);
servletContext
.
setAttribute
(
servletContext
.
setAttribute
(
WebApplicationContext
.
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
,
err
);
WebApplicationContext
.
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
,
err
);
...
@@ -312,7 +316,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
...
@@ -312,7 +316,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
try
{
try
{
this
.
embeddedServletContainer
.
stop
();
this
.
embeddedServletContainer
.
stop
();
this
.
embeddedServletContainer
=
null
;
this
.
embeddedServletContainer
=
null
;
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
IllegalStateException
(
ex
);
throw
new
IllegalStateException
(
ex
);
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/FilterRegistrationBean.java
View file @
764a0a9a
...
@@ -244,7 +244,8 @@ public class FilterRegistrationBean extends RegistrationBean {
...
@@ -244,7 +244,8 @@ public class FilterRegistrationBean extends RegistrationBean {
if
(
servletNames
.
isEmpty
()
&&
this
.
urlPatterns
.
isEmpty
())
{
if
(
servletNames
.
isEmpty
()
&&
this
.
urlPatterns
.
isEmpty
())
{
registration
.
addMappingForUrlPatterns
(
dispatcherTypes
,
this
.
matchAfter
,
registration
.
addMappingForUrlPatterns
(
dispatcherTypes
,
this
.
matchAfter
,
DEFAULT_URL_MAPPINGS
);
DEFAULT_URL_MAPPINGS
);
}
else
{
}
else
{
if
(
servletNames
.
size
()
>
0
)
{
if
(
servletNames
.
size
()
>
0
)
{
registration
.
addMappingForServletNames
(
dispatcherTypes
,
this
.
matchAfter
,
registration
.
addMappingForServletNames
(
dispatcherTypes
,
this
.
matchAfter
,
servletNames
.
toArray
(
new
String
[
servletNames
.
size
()]));
servletNames
.
toArray
(
new
String
[
servletNames
.
size
()]));
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/jetty/JettyEmbeddedServletContainer.java
View file @
764a0a9a
...
@@ -46,7 +46,8 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
...
@@ -46,7 +46,8 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
private
synchronized
void
start
()
{
private
synchronized
void
start
()
{
try
{
try
{
this
.
server
.
start
();
this
.
server
.
start
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
EmbeddedServletContainerException
(
throw
new
EmbeddedServletContainerException
(
"Unable to start embedded Jetty servlet container"
,
ex
);
"Unable to start embedded Jetty servlet container"
,
ex
);
}
}
...
@@ -56,10 +57,12 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
...
@@ -56,10 +57,12 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
public
synchronized
void
stop
()
{
public
synchronized
void
stop
()
{
try
{
try
{
this
.
server
.
stop
();
this
.
server
.
stop
();
}
catch
(
InterruptedException
ex
)
{
}
catch
(
InterruptedException
ex
)
{
Thread
.
currentThread
().
interrupt
();
Thread
.
currentThread
().
interrupt
();
// No drama
// No drama
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
EmbeddedServletContainerException
(
throw
new
EmbeddedServletContainerException
(
"Unable to stop embedded Jetty servlet container"
,
ex
);
"Unable to stop embedded Jetty servlet container"
,
ex
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java
View file @
764a0a9a
...
@@ -132,7 +132,8 @@ public class JettyEmbeddedServletContainerFactory extends
...
@@ -132,7 +132,8 @@ public class JettyEmbeddedServletContainerFactory extends
if
(
root
!=
null
)
{
if
(
root
!=
null
)
{
try
{
try
{
handler
.
setBaseResource
(
Resource
.
newResource
(
root
));
handler
.
setBaseResource
(
Resource
.
newResource
(
root
));
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
IllegalStateException
(
ex
);
throw
new
IllegalStateException
(
ex
);
}
}
}
}
...
@@ -270,11 +271,13 @@ public class JettyEmbeddedServletContainerFactory extends
...
@@ -270,11 +271,13 @@ public class JettyEmbeddedServletContainerFactory extends
if
(
errorPage
.
isGlobal
())
{
if
(
errorPage
.
isGlobal
())
{
handler
.
addErrorPage
(
ErrorPageErrorHandler
.
GLOBAL_ERROR_PAGE
,
handler
.
addErrorPage
(
ErrorPageErrorHandler
.
GLOBAL_ERROR_PAGE
,
errorPage
.
getPath
());
errorPage
.
getPath
());
}
else
{
}
else
{
if
(
errorPage
.
getExceptionName
()
!=
null
)
{
if
(
errorPage
.
getExceptionName
()
!=
null
)
{
handler
.
addErrorPage
(
errorPage
.
getExceptionName
(),
handler
.
addErrorPage
(
errorPage
.
getExceptionName
(),
errorPage
.
getPath
());
errorPage
.
getPath
());
}
else
{
}
else
{
handler
.
addErrorPage
(
errorPage
.
getStatusCode
(),
handler
.
addErrorPage
(
errorPage
.
getStatusCode
(),
errorPage
.
getPath
());
errorPage
.
getPath
());
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/tomcat/ServletContextInitializerLifecycleListener.java
View file @
764a0a9a
...
@@ -52,7 +52,8 @@ public class ServletContextInitializerLifecycleListener implements LifecycleList
...
@@ -52,7 +52,8 @@ public class ServletContextInitializerLifecycleListener implements LifecycleList
for
(
ServletContextInitializer
initializer
:
this
.
initializers
)
{
for
(
ServletContextInitializer
initializer
:
this
.
initializers
)
{
try
{
try
{
initializer
.
onStartup
(
standardContext
.
getServletContext
());
initializer
.
onStartup
(
standardContext
.
getServletContext
());
}
catch
(
ServletException
ex
)
{
}
catch
(
ServletException
ex
)
{
throw
new
IllegalStateException
(
ex
);
throw
new
IllegalStateException
(
ex
);
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/tomcat/TomcatEmbeddedServletContainer.java
View file @
764a0a9a
...
@@ -57,7 +57,8 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
...
@@ -57,7 +57,8 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
};
};
awaitThread
.
setDaemon
(
false
);
awaitThread
.
setDaemon
(
false
);
awaitThread
.
start
();
awaitThread
.
start
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
EmbeddedServletContainerException
(
throw
new
EmbeddedServletContainerException
(
"Unable to start embdedded Tomcat"
,
ex
);
"Unable to start embdedded Tomcat"
,
ex
);
}
}
...
@@ -68,10 +69,12 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
...
@@ -68,10 +69,12 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
try
{
try
{
try
{
try
{
this
.
tomcat
.
stop
();
this
.
tomcat
.
stop
();
}
catch
(
LifecycleException
e
)
{
}
catch
(
LifecycleException
e
)
{
}
}
this
.
tomcat
.
destroy
();
this
.
tomcat
.
destroy
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
EmbeddedServletContainerException
(
throw
new
EmbeddedServletContainerException
(
"Unable to stop embdedded Tomcat"
,
ex
);
"Unable to stop embdedded Tomcat"
,
ex
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java
View file @
764a0a9a
...
@@ -118,7 +118,8 @@ public class TomcatEmbeddedServletContainerFactory extends
...
@@ -118,7 +118,8 @@ public class TomcatEmbeddedServletContainerFactory extends
this
.
connector
.
setPort
(
getPort
());
this
.
connector
.
setPort
(
getPort
());
this
.
tomcat
.
getService
().
addConnector
(
this
.
connector
);
this
.
tomcat
.
getService
().
addConnector
(
this
.
connector
);
this
.
tomcat
.
setConnector
(
this
.
connector
);
this
.
tomcat
.
setConnector
(
this
.
connector
);
}
else
{
}
else
{
Connector
connector
=
new
Connector
(
Connector
connector
=
new
Connector
(
"org.apache.coyote.http11.Http11NioProtocol"
);
"org.apache.coyote.http11.Http11NioProtocol"
);
customizeConnector
(
connector
);
customizeConnector
(
connector
);
...
@@ -246,7 +247,8 @@ public class TomcatEmbeddedServletContainerFactory extends
...
@@ -246,7 +247,8 @@ public class TomcatEmbeddedServletContainerFactory extends
tempFolder
.
mkdir
();
tempFolder
.
mkdir
();
tempFolder
.
deleteOnExit
();
tempFolder
.
deleteOnExit
();
return
tempFolder
;
return
tempFolder
;
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
throw
new
EmbeddedServletContainerException
(
throw
new
EmbeddedServletContainerException
(
"Unable to create Tomcat tempdir"
,
ex
);
"Unable to create Tomcat tempdir"
,
ex
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/initializer/ConfigFileApplicationContextInitializer.java
View file @
764a0a9a
...
@@ -194,11 +194,13 @@ public class ConfigFileApplicationContextInitializer implements
...
@@ -194,11 +194,13 @@ public class ConfigFileApplicationContextInitializer implements
new
PropertiesPropertySource
(
resource
.
getDescription
(),
new
PropertiesPropertySource
(
resource
.
getDescription
(),
properties
));
properties
));
}
else
{
}
else
{
propertySources
.
addFirst
(
new
PropertiesPropertySource
(
resource
propertySources
.
addFirst
(
new
PropertiesPropertySource
(
resource
.
getDescription
(),
properties
));
.
getDescription
(),
properties
));
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
IllegalStateException
(
"Could not load properties file from "
throw
new
IllegalStateException
(
"Could not load properties file from "
+
resource
,
e
);
+
resource
,
e
);
}
}
...
@@ -252,7 +254,8 @@ public class ConfigFileApplicationContextInitializer implements
...
@@ -252,7 +254,8 @@ public class ConfigFileApplicationContextInitializer implements
}
}
// matches default profile
// matches default profile
return
MatchStatus
.
FOUND
;
return
MatchStatus
.
FOUND
;
}
else
{
}
else
{
return
MatchStatus
.
NOT_FOUND
;
return
MatchStatus
.
NOT_FOUND
;
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/initializer/ContextIdApplicationContextInitializer.java
View file @
764a0a9a
...
@@ -77,7 +77,8 @@ public class ContextIdApplicationContextInitializer implements
...
@@ -77,7 +77,8 @@ public class ContextIdApplicationContextInitializer implements
index
=
environment
.
getProperty
(
"spring.application.index"
,
Integer
.
class
,
index
);
index
=
environment
.
getProperty
(
"spring.application.index"
,
Integer
.
class
,
index
);
if
(
index
>=
0
)
{
if
(
index
>=
0
)
{
name
=
name
+
":"
+
index
;
name
=
name
+
":"
+
index
;
}
else
{
}
else
{
// FIXME do we want this
// FIXME do we want this
String
profiles
=
StringUtils
.
arrayToCommaDelimitedString
(
environment
String
profiles
=
StringUtils
.
arrayToCommaDelimitedString
(
environment
.
getActiveProfiles
());
.
getActiveProfiles
());
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/initializer/EnvironmentDelegateApplicationContextInitializer.java
View file @
764a0a9a
...
@@ -95,7 +95,8 @@ public class EnvironmentDelegateApplicationContextInitializer implements
...
@@ -95,7 +95,8 @@ public class EnvironmentDelegateApplicationContextInitializer implements
"class ["
+
className
"class ["
+
className
+
"] must implement ApplicationContextInitializer"
);
+
"] must implement ApplicationContextInitializer"
);
classes
.
add
((
Class
<
ApplicationContextInitializer
<
ConfigurableApplicationContext
>>)
clazz
);
classes
.
add
((
Class
<
ApplicationContextInitializer
<
ConfigurableApplicationContext
>>)
clazz
);
}
catch
(
ClassNotFoundException
ex
)
{
}
catch
(
ClassNotFoundException
ex
)
{
throw
new
ApplicationContextException
(
throw
new
ApplicationContextException
(
"Failed to load context initializer class ["
+
className
"Failed to load context initializer class ["
+
className
+
"]"
,
ex
);
+
"]"
,
ex
);
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/initializer/LoggingApplicationContextInitializer.java
View file @
764a0a9a
...
@@ -170,9 +170,11 @@ public class LoggingApplicationContextInitializer implements
...
@@ -170,9 +170,11 @@ public class LoggingApplicationContextInitializer implements
String
configLocation
=
getConfigLocation
(
applicationContext
);
String
configLocation
=
getConfigLocation
(
applicationContext
);
try
{
try
{
doInit
(
applicationContext
,
configLocation
);
doInit
(
applicationContext
,
configLocation
);
}
catch
(
RuntimeException
ex
)
{
}
catch
(
RuntimeException
ex
)
{
throw
ex
;
throw
ex
;
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
IllegalStateException
(
"Cannot initialize logging from "
throw
new
IllegalStateException
(
"Cannot initialize logging from "
+
configLocation
,
ex
);
+
configLocation
,
ex
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/context/initializer/VcapApplicationContextInitializer.java
View file @
764a0a9a
...
@@ -121,7 +121,8 @@ public class VcapApplicationContextInitializer implements
...
@@ -121,7 +121,8 @@ public class VcapApplicationContextInitializer implements
CommandLinePropertySource
.
COMMAND_LINE_PROPERTY_SOURCE_NAME
,
CommandLinePropertySource
.
COMMAND_LINE_PROPERTY_SOURCE_NAME
,
new
PropertiesPropertySource
(
"vcap"
,
properties
));
new
PropertiesPropertySource
(
"vcap"
,
properties
));
}
else
{
}
else
{
propertySources
.
addFirst
(
new
PropertiesPropertySource
(
"vcap"
,
properties
));
propertySources
.
addFirst
(
new
PropertiesPropertySource
(
"vcap"
,
properties
));
}
}
...
@@ -168,19 +169,22 @@ public class VcapApplicationContextInitializer implements
...
@@ -168,19 +169,22 @@ public class VcapApplicationContextInitializer implements
if
(
StringUtils
.
hasText
(
path
))
{
if
(
StringUtils
.
hasText
(
path
))
{
if
(
key
.
startsWith
(
"["
))
{
if
(
key
.
startsWith
(
"["
))
{
key
=
path
+
key
;
key
=
path
+
key
;
}
else
{
}
else
{
key
=
path
+
"."
+
key
;
key
=
path
+
"."
+
key
;
}
}
}
}
Object
value
=
entry
.
getValue
();
Object
value
=
entry
.
getValue
();
if
(
value
instanceof
String
)
{
if
(
value
instanceof
String
)
{
properties
.
put
(
key
,
value
);
properties
.
put
(
key
,
value
);
}
else
if
(
value
instanceof
Map
)
{
}
else
if
(
value
instanceof
Map
)
{
// Need a compound key
// Need a compound key
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
value
;
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
value
;
flatten
(
properties
,
map
,
key
);
flatten
(
properties
,
map
,
key
);
}
else
if
(
value
instanceof
Collection
)
{
}
else
if
(
value
instanceof
Collection
)
{
// Need a compound key
// Need a compound key
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
Collection
<
Object
>
collection
=
(
Collection
<
Object
>)
value
;
Collection
<
Object
>
collection
=
(
Collection
<
Object
>)
value
;
...
@@ -191,7 +195,8 @@ public class VcapApplicationContextInitializer implements
...
@@ -191,7 +195,8 @@ public class VcapApplicationContextInitializer implements
flatten
(
properties
,
flatten
(
properties
,
Collections
.
singletonMap
(
"["
+
(
count
++)
+
"]"
,
object
),
key
);
Collections
.
singletonMap
(
"["
+
(
count
++)
+
"]"
,
object
),
key
);
}
}
}
else
{
}
else
{
properties
.
put
(
key
,
value
==
null
?
""
:
value
);
properties
.
put
(
key
,
value
==
null
?
""
:
value
);
}
}
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/logging/JavaLoggerConfigurer.java
View file @
764a0a9a
...
@@ -40,11 +40,14 @@ public abstract class JavaLoggerConfigurer {
...
@@ -40,11 +40,14 @@ public abstract class JavaLoggerConfigurer {
try
{
try
{
LogManager
.
getLogManager
().
readConfiguration
(
LogManager
.
getLogManager
().
readConfiguration
(
ResourceUtils
.
getURL
(
resolvedLocation
).
openStream
());
ResourceUtils
.
getURL
(
resolvedLocation
).
openStream
());
}
catch
(
FileNotFoundException
e
)
{
}
catch
(
FileNotFoundException
e
)
{
throw
e
;
throw
e
;
}
catch
(
RuntimeException
e
)
{
}
catch
(
RuntimeException
e
)
{
throw
e
;
throw
e
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
IllegalArgumentException
(
"Could not initialize logging from "
throw
new
IllegalArgumentException
(
"Could not initialize logging from "
+
location
,
e
);
+
location
,
e
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/logging/LogbackConfigurer.java
View file @
764a0a9a
...
@@ -47,7 +47,8 @@ public abstract class LogbackConfigurer {
...
@@ -47,7 +47,8 @@ public abstract class LogbackConfigurer {
context
.
stop
();
context
.
stop
();
try
{
try
{
new
ContextInitializer
(
context
).
configureByResource
(
url
);
new
ContextInitializer
(
context
).
configureByResource
(
url
);
}
catch
(
JoranException
e
)
{
}
catch
(
JoranException
e
)
{
throw
new
IllegalArgumentException
(
"Could not initialize logging from "
throw
new
IllegalArgumentException
(
"Could not initialize logging from "
+
location
,
e
);
+
location
,
e
);
}
}
...
...
spring-zero-core/src/main/java/org/springframework/zero/web/SpringServletInitializer.java
View file @
764a0a9a
...
@@ -42,7 +42,8 @@ public abstract class SpringServletInitializer implements WebApplicationInitiali
...
@@ -42,7 +42,8 @@ public abstract class SpringServletInitializer implements WebApplicationInitiali
// no-op because the application context is already initialized
// no-op because the application context is already initialized
}
}
});
});
}
else
{
}
else
{
this
.
logger
this
.
logger
.
debug
(
"No ContextLoaderListener registered, as "
.
debug
(
"No ContextLoaderListener registered, as "
+
"createRootApplicationContext() did not return an application context"
);
+
"createRootApplicationContext() did not return an application context"
);
...
...
spring-zero-core/src/test/java/org/springframework/zero/SpringApplicationTests.java
View file @
764a0a9a
...
@@ -361,7 +361,8 @@ public class SpringApplicationTests {
...
@@ -361,7 +361,8 @@ public class SpringApplicationTests {
this
.
sources
=
sources
;
this
.
sources
=
sources
;
if
(
this
.
useMockLoader
)
{
if
(
this
.
useMockLoader
)
{
this
.
loader
=
mock
(
BeanDefinitionLoader
.
class
);
this
.
loader
=
mock
(
BeanDefinitionLoader
.
class
);
}
else
{
}
else
{
this
.
loader
=
spy
(
super
.
createBeanDefinitionLoader
(
registry
,
sources
));
this
.
loader
=
spy
(
super
.
createBeanDefinitionLoader
(
registry
,
sources
));
}
}
return
this
.
loader
;
return
this
.
loader
;
...
...
spring-zero-core/src/test/java/org/springframework/zero/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java
View file @
764a0a9a
...
@@ -79,7 +79,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
...
@@ -79,7 +79,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
if
(
this
.
container
!=
null
)
{
if
(
this
.
container
!=
null
)
{
try
{
try
{
this
.
container
.
stop
();
this
.
container
.
stop
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
}
}
}
}
...
@@ -156,7 +157,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
...
@@ -156,7 +157,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
try
{
try
{
Thread
.
sleep
(
500
);
Thread
.
sleep
(
500
);
date
[
0
]
=
new
Date
();
date
[
0
]
=
new
Date
();
}
catch
(
InterruptedException
ex
)
{
}
catch
(
InterruptedException
ex
)
{
throw
new
ServletException
(
ex
);
throw
new
ServletException
(
ex
);
}
}
}
}
...
@@ -249,7 +251,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
...
@@ -249,7 +251,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
ClientHttpResponse
response
=
request
.
execute
();
ClientHttpResponse
response
=
request
.
execute
();
try
{
try
{
return
StreamUtils
.
copyToString
(
response
.
getBody
(),
Charset
.
forName
(
"UTF-8"
));
return
StreamUtils
.
copyToString
(
response
.
getBody
(),
Charset
.
forName
(
"UTF-8"
));
}
finally
{
}
finally
{
response
.
close
();
response
.
close
();
}
}
}
}
...
...
spring-zero-core/src/test/java/org/springframework/zero/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java
View file @
764a0a9a
...
@@ -55,7 +55,8 @@ public class EmbeddedServletContainerMvcIntegrationTests {
...
@@ -55,7 +55,8 @@ public class EmbeddedServletContainerMvcIntegrationTests {
public
void
closeContext
()
{
public
void
closeContext
()
{
try
{
try
{
this
.
context
.
close
();
this
.
context
.
close
();
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
}
}
}
}
...
@@ -90,7 +91,8 @@ public class EmbeddedServletContainerMvcIntegrationTests {
...
@@ -90,7 +91,8 @@ public class EmbeddedServletContainerMvcIntegrationTests {
String
actual
=
StreamUtils
.
copyToString
(
response
.
getBody
(),
String
actual
=
StreamUtils
.
copyToString
(
response
.
getBody
(),
Charset
.
forName
(
"UTF-8"
));
Charset
.
forName
(
"UTF-8"
));
assertThat
(
actual
,
equalTo
(
"Hello World"
));
assertThat
(
actual
,
equalTo
(
"Hello World"
));
}
finally
{
}
finally
{
response
.
close
();
response
.
close
();
}
}
}
}
...
...
spring-zero-core/src/test/java/org/springframework/zero/context/embedded/MockEmbeddedServletContainerFactory.java
View file @
764a0a9a
...
@@ -132,7 +132,8 @@ public class MockEmbeddedServletContainerFactory extends
...
@@ -132,7 +132,8 @@ public class MockEmbeddedServletContainerFactory extends
for
(
ServletContextInitializer
initializer
:
this
.
initializers
)
{
for
(
ServletContextInitializer
initializer
:
this
.
initializers
)
{
initializer
.
onStartup
(
this
.
servletContext
);
initializer
.
onStartup
(
this
.
servletContext
);
}
}
}
catch
(
ServletException
ex
)
{
}
catch
(
ServletException
ex
)
{
throw
new
RuntimeException
(
ex
);
throw
new
RuntimeException
(
ex
);
}
}
}
}
...
...
spring-zero-launcher/src/main/java/org/springframework/zero/launcher/Launcher.java
View file @
764a0a9a
...
@@ -55,7 +55,8 @@ public abstract class Launcher {
...
@@ -55,7 +55,8 @@ public abstract class Launcher {
public
void
launch
(
String
[]
args
)
{
public
void
launch
(
String
[]
args
)
{
try
{
try
{
launch
(
args
,
getClass
().
getProtectionDomain
());
launch
(
args
,
getClass
().
getProtectionDomain
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
System
.
exit
(
1
);
System
.
exit
(
1
);
}
}
...
...
spring-zero-launcher/src/main/java/org/springframework/zero/launcher/MainMethodRunner.java
View file @
764a0a9a
...
@@ -51,7 +51,8 @@ public class MainMethodRunner implements Runnable {
...
@@ -51,7 +51,8 @@ public class MainMethodRunner implements Runnable {
+
" does not have a main method"
);
+
" does not have a main method"
);
}
}
mainMethod
.
invoke
(
null
,
new
Object
[]
{
args
});
mainMethod
.
invoke
(
null
,
new
Object
[]
{
args
});
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
System
.
exit
(
1
);
System
.
exit
(
1
);
}
}
...
...
spring-zero-launcher/src/main/java/org/springframework/zero/launcher/WarLauncher.java
View file @
764a0a9a
...
@@ -36,7 +36,8 @@ public class WarLauncher extends Launcher {
...
@@ -36,7 +36,8 @@ public class WarLauncher extends Launcher {
protected
boolean
isNestedJarFile
(
JarEntry
jarEntry
)
{
protected
boolean
isNestedJarFile
(
JarEntry
jarEntry
)
{
if
(
jarEntry
.
isDirectory
())
{
if
(
jarEntry
.
isDirectory
())
{
return
jarEntry
.
getName
().
equals
(
"WEB-INF/classes/"
);
return
jarEntry
.
getName
().
equals
(
"WEB-INF/classes/"
);
}
else
{
}
else
{
return
jarEntry
.
getName
().
startsWith
(
"WEB-INF/lib/"
)
return
jarEntry
.
getName
().
startsWith
(
"WEB-INF/lib/"
)
||
jarEntry
.
getName
().
startsWith
(
"WEB-INF/lib-provided/"
);
||
jarEntry
.
getName
().
startsWith
(
"WEB-INF/lib-provided/"
);
}
}
...
...
spring-zero-launcher/src/main/java/org/springframework/zero/launcher/data/RandomAccessDataFile.java
View file @
764a0a9a
...
@@ -163,10 +163,12 @@ public class RandomAccessDataFile implements RandomAccessData {
...
@@ -163,10 +163,12 @@ public class RandomAccessDataFile implements RandomAccessData {
int
rtn
=
file
.
read
();
int
rtn
=
file
.
read
();
moveOn
(
rtn
==
-
1
?
0
:
1
);
moveOn
(
rtn
==
-
1
?
0
:
1
);
return
rtn
;
return
rtn
;
}
else
{
}
else
{
return
(
int
)
moveOn
(
file
.
read
(
b
,
off
,
(
int
)
cap
(
len
)));
return
(
int
)
moveOn
(
file
.
read
(
b
,
off
,
(
int
)
cap
(
len
)));
}
}
}
finally
{
}
finally
{
RandomAccessDataFile
.
this
.
filePool
.
release
(
file
);
RandomAccessDataFile
.
this
.
filePool
.
release
(
file
);
}
}
}
}
...
@@ -222,7 +224,8 @@ public class RandomAccessDataFile implements RandomAccessData {
...
@@ -222,7 +224,8 @@ public class RandomAccessDataFile implements RandomAccessData {
RandomAccessFile
file
=
this
.
files
.
poll
();
RandomAccessFile
file
=
this
.
files
.
poll
();
return
(
file
==
null
?
new
RandomAccessFile
(
return
(
file
==
null
?
new
RandomAccessFile
(
RandomAccessDataFile
.
this
.
file
,
"r"
)
:
file
);
RandomAccessDataFile
.
this
.
file
,
"r"
)
:
file
);
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
throw
new
IOException
(
e
);
throw
new
IOException
(
e
);
}
}
}
}
...
@@ -241,10 +244,12 @@ public class RandomAccessDataFile implements RandomAccessData {
...
@@ -241,10 +244,12 @@ public class RandomAccessDataFile implements RandomAccessData {
file
.
close
();
file
.
close
();
file
=
files
.
poll
();
file
=
files
.
poll
();
}
}
}
finally
{
}
finally
{
this
.
available
.
release
(
size
);
this
.
available
.
release
(
size
);
}
}
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
throw
new
IOException
(
e
);
throw
new
IOException
(
e
);
}
}
}
}
...
...
spring-zero-launcher/src/main/java/org/springframework/zero/launcher/jar/RandomAccessJarFile.java
View file @
764a0a9a
...
@@ -127,7 +127,8 @@ public class RandomAccessJarFile extends JarFile {
...
@@ -127,7 +127,8 @@ public class RandomAccessJarFile extends JarFile {
((
Entry
)
containedEntry
).
configure
(
this
.
manifest
);
((
Entry
)
containedEntry
).
configure
(
this
.
manifest
);
}
}
}
}
}
finally
{
}
finally
{
inputStream
.
close
();
inputStream
.
close
();
}
}
}
}
...
@@ -220,7 +221,8 @@ public class RandomAccessJarFile extends JarFile {
...
@@ -220,7 +221,8 @@ public class RandomAccessJarFile extends JarFile {
return
new
RandomAccessJarFile
(
this
.
rootJarFile
,
getName
()
+
"!/"
return
new
RandomAccessJarFile
(
this
.
rootJarFile
,
getName
()
+
"!/"
+
directoryName
.
substring
(
0
,
directoryName
.
length
()
-
1
),
this
.
data
,
+
directoryName
.
substring
(
0
,
directoryName
.
length
()
-
1
),
this
.
data
,
filtersToUse
);
filtersToUse
);
}
else
{
}
else
{
if
(
ze
.
getMethod
()
!=
ZipEntry
.
STORED
)
{
if
(
ze
.
getMethod
()
!=
ZipEntry
.
STORED
)
{
throw
new
IllegalStateException
(
"Unable to open nested compressed entry "
throw
new
IllegalStateException
(
"Unable to open nested compressed entry "
+
ze
.
getName
());
+
ze
.
getName
());
...
@@ -411,7 +413,8 @@ public class RandomAccessJarFile extends JarFile {
...
@@ -411,7 +413,8 @@ public class RandomAccessJarFile extends JarFile {
connect
();
connect
();
return
(
int
)
(
this
.
jarEntry
==
null
?
this
.
jarFile
.
size
()
:
this
.
jarEntry
return
(
int
)
(
this
.
jarEntry
==
null
?
this
.
jarFile
.
size
()
:
this
.
jarEntry
.
getSize
());
.
getSize
());
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -453,7 +456,8 @@ public class RandomAccessJarFile extends JarFile {
...
@@ -453,7 +456,8 @@ public class RandomAccessJarFile extends JarFile {
protected
void
fill
()
throws
IOException
{
protected
void
fill
()
throws
IOException
{
try
{
try
{
super
.
fill
();
super
.
fill
();
}
catch
(
EOFException
ex
)
{
}
catch
(
EOFException
ex
)
{
if
(
this
.
extraBytesWritten
)
{
if
(
this
.
extraBytesWritten
)
{
throw
ex
;
throw
ex
;
}
}
...
...
spring-zero-launcher/src/test/java/org/springframework/zero/launcher/jar/RandomAccessDataZipInputStreamTest.java
View file @
764a0a9a
...
@@ -54,7 +54,8 @@ public class RandomAccessDataZipInputStreamTest {
...
@@ -54,7 +54,8 @@ public class RandomAccessDataZipInputStreamTest {
try
{
try
{
writeDataEntry
(
zipOutputStream
,
"a"
,
new
byte
[
10
]);
writeDataEntry
(
zipOutputStream
,
"a"
,
new
byte
[
10
]);
writeDataEntry
(
zipOutputStream
,
"b"
,
new
byte
[
20
]);
writeDataEntry
(
zipOutputStream
,
"b"
,
new
byte
[
20
]);
}
finally
{
}
finally
{
zipOutputStream
.
close
();
zipOutputStream
.
close
();
}
}
}
}
...
@@ -85,7 +86,8 @@ public class RandomAccessDataZipInputStreamTest {
...
@@ -85,7 +86,8 @@ public class RandomAccessDataZipInputStreamTest {
assertThat
(
entry2
.
getName
(),
equalTo
(
"b"
));
assertThat
(
entry2
.
getName
(),
equalTo
(
"b"
));
assertThat
(
entry2
.
getData
().
getSize
(),
equalTo
(
20L
));
assertThat
(
entry2
.
getData
().
getSize
(),
equalTo
(
20L
));
assertThat
(
z
.
getNextEntry
(),
nullValue
());
assertThat
(
z
.
getNextEntry
(),
nullValue
());
}
finally
{
}
finally
{
z
.
close
();
z
.
close
();
}
}
}
}
...
...
spring-zero-launcher/src/test/java/org/springframework/zero/launcher/jar/RandomAccessJarFileTest.java
View file @
764a0a9a
...
@@ -93,7 +93,8 @@ public class RandomAccessJarFileTest {
...
@@ -93,7 +93,8 @@ public class RandomAccessJarFileTest {
jarOutputStream
.
putNextEntry
(
nestedEntry
);
jarOutputStream
.
putNextEntry
(
nestedEntry
);
jarOutputStream
.
write
(
nestedJarData
);
jarOutputStream
.
write
(
nestedJarData
);
jarOutputStream
.
closeEntry
();
jarOutputStream
.
closeEntry
();
}
finally
{
}
finally
{
jarOutputStream
.
close
();
jarOutputStream
.
close
();
}
}
this
.
jarFile
=
new
RandomAccessJarFile
(
this
.
rootJarFile
);
this
.
jarFile
=
new
RandomAccessJarFile
(
this
.
rootJarFile
);
...
...
spring-zero-maven-plugin/src/main/java/org/springframework/zero/maven/AbstractExecutableArchiveMojo.java
View file @
764a0a9a
...
@@ -187,7 +187,8 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
...
@@ -187,7 +187,8 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
File
archiveFile
=
createArchive
();
File
archiveFile
=
createArchive
();
if
(
this
.
classifier
==
null
||
this
.
classifier
.
isEmpty
())
{
if
(
this
.
classifier
==
null
||
this
.
classifier
.
isEmpty
())
{
this
.
project
.
getArtifact
().
setFile
(
archiveFile
);
this
.
project
.
getArtifact
().
setFile
(
archiveFile
);
}
else
{
}
else
{
this
.
projectHelper
.
attachArtifact
(
this
.
project
,
getType
(),
this
.
classifier
,
this
.
projectHelper
.
attachArtifact
(
this
.
project
,
getType
(),
this
.
classifier
,
archiveFile
);
archiveFile
);
}
}
...
@@ -209,10 +210,12 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
...
@@ -209,10 +210,12 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
try
{
try
{
archiver
.
createArchive
(
this
.
session
,
this
.
project
,
this
.
archive
);
archiver
.
createArchive
(
this
.
session
,
this
.
project
,
this
.
archive
);
return
archiveFile
;
return
archiveFile
;
}
finally
{
}
finally
{
zipFile
.
close
();
zipFile
.
close
();
}
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
MojoExecutionException
(
"Error assembling archive"
,
ex
);
throw
new
MojoExecutionException
(
"Error assembling archive"
,
ex
);
}
}
}
}
...
@@ -306,7 +309,8 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
...
@@ -306,7 +309,8 @@ public abstract class AbstractExecutableArchiveMojo extends AbstractMojo {
throw
new
MojoExecutionException
(
"Unable to resolve launcher classes"
);
throw
new
MojoExecutionException
(
"Unable to resolve launcher classes"
);
}
}
return
addLauncherClasses
(
archiver
,
artifactResult
.
getArtifact
().
getFile
());
return
addLauncherClasses
(
archiver
,
artifactResult
.
getArtifact
().
getFile
());
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
if
(
ex
instanceof
MojoExecutionException
)
{
if
(
ex
instanceof
MojoExecutionException
)
{
throw
(
MojoExecutionException
)
ex
;
throw
(
MojoExecutionException
)
ex
;
}
}
...
...
spring-zero-maven-plugin/src/main/java/org/springframework/zero/maven/MainClassFinder.java
View file @
764a0a9a
...
@@ -101,10 +101,12 @@ class MainClassFinder {
...
@@ -101,10 +101,12 @@ class MainClassFinder {
MainMethodFinder
mainMethodFinder
=
new
MainMethodFinder
();
MainMethodFinder
mainMethodFinder
=
new
MainMethodFinder
();
classReader
.
accept
(
mainMethodFinder
,
ClassReader
.
SKIP_CODE
);
classReader
.
accept
(
mainMethodFinder
,
ClassReader
.
SKIP_CODE
);
return
mainMethodFinder
.
isFound
();
return
mainMethodFinder
.
isFound
();
}
finally
{
}
finally
{
inputStream
.
close
();
inputStream
.
close
();
}
}
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
return
false
;
return
false
;
}
}
}
}
...
...
spring-zero-maven-plugin/src/test/java/org/springframework/zero/maven/MainClassFinderTests.java
View file @
764a0a9a
...
@@ -87,7 +87,8 @@ public class MainClassFinderTests {
...
@@ -87,7 +87,8 @@ public class MainClassFinderTests {
OutputStream
outputStream
=
new
FileOutputStream
(
file
);
OutputStream
outputStream
=
new
FileOutputStream
(
file
);
try
{
try
{
IOUtil
.
copy
(
inputStream
,
outputStream
);
IOUtil
.
copy
(
inputStream
,
outputStream
);
}
finally
{
}
finally
{
outputStream
.
close
();
outputStream
.
close
();
}
}
return
file
;
return
file
;
...
...
spring-zero-samples/spring-zero-sample-profile/src/test/java/org/springframework/zero/sample/profile/SampleProfileApplicationTests.java
View file @
764a0a9a
...
@@ -34,7 +34,8 @@ public class SampleProfileApplicationTests {
...
@@ -34,7 +34,8 @@ public class SampleProfileApplicationTests {
public
void
after
()
{
public
void
after
()
{
if
(
this
.
profiles
!=
null
)
{
if
(
this
.
profiles
!=
null
)
{
System
.
setProperty
(
"spring.profiles.active"
,
this
.
profiles
);
System
.
setProperty
(
"spring.profiles.active"
,
this
.
profiles
);
}
else
{
}
else
{
System
.
clearProperty
(
"spring.profiles.active"
);
System
.
clearProperty
(
"spring.profiles.active"
);
}
}
}
}
...
...
spring-zero-samples/spring-zero-sample-simple/src/test/java/org/springframework/zero/sample/simple/SampleSimpleApplicationTests.java
View file @
764a0a9a
...
@@ -35,7 +35,8 @@ public class SampleSimpleApplicationTests {
...
@@ -35,7 +35,8 @@ public class SampleSimpleApplicationTests {
public
void
after
()
{
public
void
after
()
{
if
(
this
.
profiles
!=
null
)
{
if
(
this
.
profiles
!=
null
)
{
System
.
setProperty
(
"spring.profiles.active"
,
this
.
profiles
);
System
.
setProperty
(
"spring.profiles.active"
,
this
.
profiles
);
}
else
{
}
else
{
System
.
clearProperty
(
"spring.profiles.active"
);
System
.
clearProperty
(
"spring.profiles.active"
);
}
}
System
.
setOut
(
this
.
savedOutput
);
System
.
setOut
(
this
.
savedOutput
);
...
...
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