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
cf23b519
Commit
cf23b519
authored
Feb 24, 2014
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
89473077
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
97 additions
and
87 deletions
+97
-87
howto.md
docs/howto.md
+3
-3
EndpointAutoConfiguration.java
...boot/actuate/autoconfigure/EndpointAutoConfiguration.java
+1
-1
RequestMappingEndpoint.java
...amework/boot/actuate/endpoint/RequestMappingEndpoint.java
+12
-8
ShutdownMvcEndpointTests.java
...k/boot/actuate/endpoint/mvc/ShutdownMvcEndpointTests.java
+3
-1
BatchAutoConfiguration.java
...work/boot/autoconfigure/batch/BatchAutoConfiguration.java
+5
-5
JobLauncherCommandLineRunner.java
...oot/autoconfigure/batch/JobLauncherCommandLineRunner.java
+1
-1
DataSourceAutoConfiguration.java
.../boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java
+11
-10
ThymeleafAutoConfiguration.java
...t/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java
+7
-7
DispatcherServletAutoConfiguration.java
...autoconfigure/web/DispatcherServletAutoConfiguration.java
+1
-1
ServerProperties.java
...ingframework/boot/autoconfigure/web/ServerProperties.java
+1
-1
JobLauncherCommandLineRunnerTests.java
...utoconfigure/batch/JobLauncherCommandLineRunnerTests.java
+3
-1
ThymeleafAutoConfigurationTests.java
...oconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java
+1
-1
DispatcherServletAutoConfigurationTests.java
...onfigure/web/DispatcherServletAutoConfigurationTests.java
+3
-1
EmbeddedServletContainerAutoConfigurationTests.java
...e/web/EmbeddedServletContainerAutoConfigurationTests.java
+1
-1
MultipartAutoConfigurationTests.java
...ot/autoconfigure/web/MultipartAutoConfigurationTests.java
+1
-1
NonAutoConfigurationSampleTomcatApplicationTests.java
...cat/NonAutoConfigurationSampleTomcatApplicationTests.java
+2
-1
SpringApplication.java
...main/java/org/springframework/boot/SpringApplication.java
+20
-22
SpringApplicationRunListener.java
...rg/springframework/boot/SpringApplicationRunListener.java
+4
-4
PropertiesConfigurationFactory.java
...ngframework/boot/bind/PropertiesConfigurationFactory.java
+3
-3
AbstractLoggingSystem.java
...g/springframework/boot/logging/AbstractLoggingSystem.java
+1
-1
base.xml
...sources/org/springframework/boot/logging/logback/base.xml
+1
-1
basic-logback.xml
...rg/springframework/boot/logging/logback/basic-logback.xml
+1
-1
logback.xml
...rces/org/springframework/boot/logging/logback/logback.xml
+4
-4
AdhocTestSuite.java
...rc/test/java/org/springframework/boot/AdhocTestSuite.java
+1
-1
LoggingApplicationListenerTests.java
...amework/boot/logging/LoggingApplicationListenerTests.java
+6
-6
No files found.
docs/howto.md
View file @
cf23b519
...
...
@@ -866,7 +866,7 @@ database is in a server.
JPA has features for DDL generation, and these can be set up to
run on startup against the database. This is controlled through two
external properties:
external properties:
*
`spring.jpa.generate-ddl`
(boolean) switches the feature on and off
and is vendor independent
...
...
@@ -902,7 +902,7 @@ enables it by default and loads SQL from the standard locations
addition Spring Boot will load a file
`schema-${platform}.sql`
where
`platform`
is the vendor name of the database (
`hsqldb`
,
`h2,
`
oracle
`, `
mysql
`, `
postgresql
` etc.). Spring Boot enables the
failfast feature of the Spring JDBC initializer by default, so if
failfast feature of the Spring JDBC initializer by default, so if
the scripts cause exceptions the application will fail.
To disable the failfast you can set
...
...
@@ -945,7 +945,7 @@ startup (see
[JobLauncherCommandLineRunner](https://github.com/spring-projects/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java)
for details). You can narrow down to a specific job or jobs by
specifying `
spring.batch.job.names
` (comma separated job name
patterns).
patterns).
If the application context includes a `
JobRegistry
` then
the jobs in `
spring.batch.job.names
` are looked up in the regsitry
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -31,6 +31,8 @@ import org.springframework.web.servlet.handler.AbstractHandlerMethodMapping;
import
org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
;
/**
* {@link Endpoint} to expose Spring MVC mappings.
*
* @author Dave Syer
*/
public
class
RequestMappingEndpoint
extends
AbstractEndpoint
<
Map
<
String
,
Object
>>
...
...
@@ -118,10 +120,10 @@ public class RequestMappingEndpoint extends AbstractEndpoint<Map<String, Object>
Map
<
String
,
Object
>
result
)
{
for
(
AbstractUrlHandlerMapping
mapping
:
handlerMappings
)
{
Map
<
String
,
Object
>
handlers
=
mapping
.
getHandlerMap
();
for
(
String
key
:
handlers
.
ke
ySet
())
{
Object
handler
=
handlers
.
get
(
key
);
result
.
put
(
key
,
Collections
.
singletonMap
(
"type"
,
handler
.
getClass
()
.
getName
()));
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
handlers
.
entr
ySet
())
{
Class
<?
extends
Object
>
handlerClass
=
entry
.
getValue
().
getClass
(
);
result
.
put
(
entry
.
getKey
()
,
Collections
.
singletonMap
(
"type"
,
handler
Class
.
getName
()));
}
}
}
...
...
@@ -131,9 +133,11 @@ public class RequestMappingEndpoint extends AbstractEndpoint<Map<String, Object>
Map
<
String
,
Object
>
result
)
{
for
(
AbstractHandlerMethodMapping
<?>
mapping
:
methodMappings
)
{
Map
<?,
HandlerMethod
>
methods
=
mapping
.
getHandlerMethods
();
for
(
Object
key
:
methods
.
keySet
())
{
result
.
put
(
key
.
toString
(),
Collections
.
singletonMap
(
"method"
,
methods
.
get
(
key
).
toString
()));
for
(
Map
.
Entry
<?,
HandlerMethod
>
entry
:
methods
.
entrySet
())
{
result
.
put
(
String
.
valueOf
(
entry
.
getKey
()),
Collections
.
singletonMap
(
"method"
,
String
.
valueOf
(
entry
.
getValue
())));
}
}
}
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpointTests.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -29,6 +29,8 @@ import static org.mockito.Mockito.mock;
import
static
org
.
mockito
.
Mockito
.
when
;
/**
* Tests for {@link ShutdownMvcEndpoint}.
*
* @author Dave Syer
*/
public
class
ShutdownMvcEndpointTests
{
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java
View file @
cf23b519
...
...
@@ -46,12 +46,12 @@ import org.springframework.util.StringUtils;
/**
* {@link EnableAutoConfiguration Auto-configuration} for Spring Batch. By default a
* Runner will be created and all jobs in the context will be executed on startup.
*
* Disable this behavio
ur with <code>spring.batch.job.enabled=false</code>
).
*
*
<p>
* Disable this behavio
r with {@literal spring.batch.job.enabled=false}
).
*
<p>
* Alternatively, discrete Job names to execute on startup can be supplied by the User
* with a comma-delimited list:
<code>spring.batch.job.names=job1,job2</code>. In this
*
case
the Runner will first find jobs registered as Beans, then those in the existing
* with a comma-delimited list:
{@literal spring.batch.job.names=job1,job2}. In this case
* the Runner will first find jobs registered as Beans, then those in the existing
* JobRegistry.
*
* @author Dave Syer
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java
View file @
cf23b519
...
...
@@ -64,7 +64,7 @@ import org.springframework.util.StringUtils;
* @author Phillip Webb
*/
@Configuration
@ConditionalOnClass
(
EmbeddedDatabaseType
.
class
/* Spring JDBC */
)
@ConditionalOnClass
(
EmbeddedDatabaseType
.
class
)
public
class
DataSourceAutoConfiguration
implements
EnvironmentAware
{
private
static
Log
logger
=
LogFactory
.
getLog
(
DataSourceAutoConfiguration
.
class
);
...
...
@@ -77,26 +77,27 @@ public class DataSourceAutoConfiguration implements EnvironmentAware {
@Autowired
private
ApplicationContext
applicationContext
;
private
RelaxedPropertyResolver
environment
;
private
RelaxedPropertyResolver
datasourceProperties
;
@Override
public
void
setEnvironment
(
Environment
environment
)
{
this
.
environment
=
new
RelaxedPropertyResolver
(
environment
,
CONFIGURATION_PREFIX
+
"."
);
this
.
datasourceProperties
=
new
RelaxedPropertyResolver
(
environment
,
CONFIGURATION_PREFIX
+
"."
);
}
@PostConstruct
protected
void
initialize
()
throws
Exception
{
if
(
this
.
dataSource
==
null
||
!
this
.
environment
.
getProperty
(
"initialize"
,
Boolean
.
class
,
true
))
{
boolean
initialize
=
this
.
datasourceProperties
.
getProperty
(
"initialize"
,
Boolean
.
class
,
true
);
if
(
this
.
dataSource
==
null
||
!
initialize
)
{
logger
.
debug
(
"No DataSource found so not initializing"
);
return
;
}
String
schema
=
this
.
environment
.
getProperty
(
"schema"
);
String
schema
=
this
.
datasourceProperties
.
getProperty
(
"schema"
);
if
(
schema
==
null
)
{
schema
=
"classpath*:schema-"
+
this
.
environment
.
getProperty
(
"platform"
,
"all"
)
+
this
.
datasourceProperties
.
getProperty
(
"platform"
,
"all"
)
+
".sql,classpath*:schema.sql,classpath*:data.sql"
;
}
...
...
@@ -106,8 +107,8 @@ public class DataSourceAutoConfiguration implements EnvironmentAware {
.
getResources
(
schemaLocation
)));
}
boolean
continueOnError
=
this
.
environment
.
getProperty
(
"continueOnError"
,
Boolean
.
class
,
false
);
boolean
continueOnError
=
this
.
datasourceProperties
.
getProperty
(
"continueOnError"
,
Boolean
.
class
,
false
);
boolean
exists
=
false
;
ResourceDatabasePopulator
populator
=
new
ResourceDatabasePopulator
();
for
(
Resource
resource
:
resources
)
{
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -39,6 +39,7 @@ import org.springframework.core.env.Environment;
import
org.springframework.core.io.DefaultResourceLoader
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.ResourceLoader
;
import
org.springframework.util.Assert
;
import
org.thymeleaf.dialect.IDialect
;
import
org.thymeleaf.extras.springsecurity3.dialect.SpringSecurityDialect
;
import
org.thymeleaf.spring4.SpringTemplateEngine
;
...
...
@@ -78,14 +79,13 @@ public class ThymeleafAutoConfiguration {
@PostConstruct
public
void
checkTemplateLocationExists
()
{
if
(
this
.
environment
.
getProperty
(
"checkTemplateLocation"
,
Boolean
.
class
,
true
))
{
Boolean
checkTemplateLocation
=
this
.
environment
.
getProperty
(
"checkTemplateLocation"
,
Boolean
.
class
,
true
);
if
(
checkTemplateLocation
)
{
Resource
resource
=
this
.
resourceLoader
.
getResource
(
this
.
environment
.
getProperty
(
"prefix"
,
DEFAULT_PREFIX
));
if
(!
resource
.
exists
())
{
throw
new
IllegalStateException
(
"Cannot find template location: "
+
resource
+
" (are you really using Thymeleaf?)"
);
}
Assert
.
state
(
resource
.
exists
(),
"Cannot find template location: "
+
resource
+
" (are you really using Thymeleaf?)"
);
}
}
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunnerTests.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -47,6 +47,8 @@ import org.springframework.transaction.PlatformTransactionManager;
import
static
org
.
junit
.
Assert
.
assertEquals
;
/**
* Tests for {@link JobLauncherCommandLineRunner}.
*
* @author Dave Syer
*/
public
class
JobLauncherCommandLineRunnerTests
{
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfigurationTests.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -27,6 +27,8 @@ import static org.junit.Assert.assertEquals;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
/**
* Tests for {@link DispatcherServletAutoConfiguration}.
*
* @author Dave Syer
*/
public
class
DispatcherServletAutoConfigurationTests
{
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -44,6 +44,7 @@ import org.springframework.web.client.RestTemplate;
import
sample.tomcat.service.HelloWorldService
;
import
sample.tomcat.web.SampleController
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
/**
...
...
spring-boot/src/main/java/org/springframework/boot/SpringApplication.java
View file @
cf23b519
...
...
@@ -261,9 +261,9 @@ public class SpringApplication {
System
.
setProperty
(
"java.awt.headless"
,
Boolean
.
toString
(
this
.
headless
));
Collection
<
SpringApplicationRunListener
>
participants
=
createRunParticipant
s
(
args
);
for
(
SpringApplicationRunListener
participant
:
participant
s
)
{
participant
.
started
();
Collection
<
SpringApplicationRunListener
>
runListeners
=
getRunListener
s
(
args
);
for
(
SpringApplicationRunListener
runListener
:
runListener
s
)
{
runListener
.
started
();
}
try
{
...
...
@@ -271,8 +271,8 @@ public class SpringApplication {
ConfigurableEnvironment
environment
=
getOrCreateEnvironment
();
addPropertySources
(
environment
,
args
);
setupProfiles
(
environment
);
for
(
SpringApplicationRunListener
participant
:
participant
s
)
{
participant
.
environmentPrepared
(
environment
);
for
(
SpringApplicationRunListener
runListener
:
runListener
s
)
{
runListener
.
environmentPrepared
(
environment
);
}
if
(
this
.
showBanner
)
{
...
...
@@ -287,8 +287,8 @@ public class SpringApplication {
context
.
setEnvironment
(
environment
);
postProcessApplicationContext
(
context
);
applyInitializers
(
context
);
for
(
SpringApplicationRunListener
participant
:
participant
s
)
{
participant
.
contextPrepared
(
context
);
for
(
SpringApplicationRunListener
runListener
:
runListener
s
)
{
runListener
.
contextPrepared
(
context
);
}
if
(
this
.
logStartupInfo
)
{
logStartupInfo
(
context
.
getParent
()
==
null
);
...
...
@@ -298,15 +298,15 @@ public class SpringApplication {
Set
<
Object
>
sources
=
getSources
();
Assert
.
notEmpty
(
sources
,
"Sources must not be empty"
);
load
(
context
,
sources
.
toArray
(
new
Object
[
sources
.
size
()]));
for
(
SpringApplicationRunListener
participant
:
participant
s
)
{
participant
.
contextLoaded
(
context
);
for
(
SpringApplicationRunListener
runListener
:
runListener
s
)
{
runListener
.
contextLoaded
(
context
);
}
// Refresh the context
refresh
(
context
);
afterRefresh
(
context
,
args
);
for
(
SpringApplicationRunListener
participant
:
participant
s
)
{
participant
.
finished
(
context
,
null
);
for
(
SpringApplicationRunListener
runListener
:
runListener
s
)
{
runListener
.
finished
(
context
,
null
);
}
stopWatch
.
stop
();
...
...
@@ -317,8 +317,8 @@ public class SpringApplication {
return
context
;
}
catch
(
Exception
ex
)
{
for
(
SpringApplicationRunListener
participant
:
participant
s
)
{
finishWithException
(
participant
,
context
,
ex
);
for
(
SpringApplicationRunListener
runListener
:
runListener
s
)
{
finishWithException
(
runListener
,
context
,
ex
);
}
if
(
context
!=
null
)
{
context
.
close
();
...
...
@@ -330,13 +330,11 @@ public class SpringApplication {
}
}
private
Collection
<
SpringApplicationRunListener
>
createRunParticipants
(
String
[]
args
)
{
List
<
SpringApplicationRunListener
>
participants
=
new
ArrayList
<
SpringApplicationRunListener
>();
participants
.
addAll
(
getSpringFactoriesInstances
(
SpringApplicationRunListener
.
class
,
new
Class
<?>[]
{
SpringApplication
.
class
,
String
[].
class
},
this
,
args
));
return
participants
;
private
Collection
<
SpringApplicationRunListener
>
getRunListeners
(
String
[]
args
)
{
List
<
SpringApplicationRunListener
>
listeners
=
new
ArrayList
<
SpringApplicationRunListener
>();
listeners
.
addAll
(
getSpringFactoriesInstances
(
SpringApplicationRunListener
.
class
,
new
Class
<?>[]
{
SpringApplication
.
class
,
String
[].
class
},
this
,
args
));
return
listeners
;
}
private
<
T
>
Collection
<?
extends
T
>
getSpringFactoriesInstances
(
Class
<
T
>
type
)
{
...
...
@@ -625,10 +623,10 @@ public class SpringApplication {
runCommandLineRunners
(
context
,
args
);
}
private
void
finishWithException
(
SpringApplicationRunListener
participant
,
private
void
finishWithException
(
SpringApplicationRunListener
runListener
,
ConfigurableApplicationContext
context
,
Exception
exception
)
{
try
{
participant
.
finished
(
context
,
exception
);
runListener
.
finished
(
context
,
exception
);
}
catch
(
Exception
ex
)
{
if
(
this
.
log
.
isDebugEnabled
())
{
...
...
spring-boot/src/main/java/org/springframework/boot/SpringApplicationRunListener.java
View file @
cf23b519
...
...
@@ -22,10 +22,10 @@ import org.springframework.core.env.ConfigurableEnvironment;
import
org.springframework.core.io.support.SpringFactoriesLoader
;
/**
*
Strategy class to allow dynamic participation when the {@link SpringApplication}
* {@
code run} method is called. Participants are loaded via the
*
{@link SpringFactoriesLoader} and should declare a public constructor that accepts a
*
{@link SpringApplication}
instance and a {@code String[]} of arguments. A new
*
Listener for the {@link SpringApplication} {@code run} method.
* {@
link SpringApplicationRunListener}s are loaded via the {@link SpringFactoriesLoader}
*
and should declare a public constructor that accepts a {@link SpringApplication}
* instance and a {@code String[]} of arguments. A new
* {@link SpringApplicationRunListener} instance will be created for each run.
*
* @author Phillip Webb
...
...
spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -253,12 +253,12 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
if
(
this
.
target
!=
null
)
{
PropertyDescriptor
[]
descriptors
=
BeanUtils
.
getPropertyDescriptors
(
this
.
target
.
getClass
());
String
prefix
=
this
.
targetName
!=
null
?
this
.
targetName
+
"."
:
""
;
String
prefix
=
(
this
.
targetName
!=
null
?
this
.
targetName
+
"."
:
""
)
;
String
[]
suffixes
=
new
String
[]
{
".*"
,
"_*"
};
for
(
PropertyDescriptor
descriptor
:
descriptors
)
{
String
name
=
descriptor
.
getName
();
if
(!
name
.
equals
(
"class"
))
{
for
(
String
relaxedName
:
new
RelaxedNames
(
prefix
+
name
))
{
for
(
String
relaxedName
:
new
RelaxedNames
(
prefix
+
name
))
{
names
.
add
(
relaxedName
);
patterns
.
add
(
relaxedName
);
for
(
String
suffix
:
suffixes
)
{
...
...
spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot/src/main/resources/org/springframework/boot/logging/logback/base.xml
View file @
cf23b519
<?xml version="1.0" encoding="UTF-8"?>
<included>
<include
resource=
"org/springframework/boot/logging/logback/basic-logback.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/basic-logback.xml"
/>
<property
name=
"LOG_FILE"
value=
"${LOG_FILE:-${LOG_PATH:-/tmp/}spring.log}"
/>
<property
name=
"FILE_LOG_PATTERN"
value=
"%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } [%t] --- %-40.40logger{39} : %m%n%wex"
/>
...
...
spring-boot/src/main/resources/org/springframework/boot/logging/logback/basic-logback.xml
View file @
cf23b519
...
...
@@ -28,4 +28,4 @@
<appender-ref
ref=
"DEBUG_LEVEL_REMAPPER"
/>
</logger>
</included>
\ No newline at end of file
</included>
spring-boot/src/main/resources/org/springframework/boot/logging/logback/logback.xml
View file @
cf23b519
...
...
@@ -2,17 +2,17 @@
<configuration>
<!--
This file is the default logback configuration for Spring Boot. To use the same
defaults and add custom logger levels you can copy this file and add additional
overrides, e.g:
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<logger name="org.springframework.web" level="DEBUG"/>
...
-->
<include
resource=
"org/springframework/boot/logging/logback/base.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/base.xml"
/>
</configuration>
spring-boot/src/test/java/org/springframework/boot/AdhocTestSuite.java
View file @
cf23b519
/*
* Copyright 2012-201
3
the original author or authors.
* Copyright 2012-201
4
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java
View file @
cf23b519
...
...
@@ -86,7 +86,7 @@ public class LoggingApplicationListenerTests {
}
@Test
public
void
testB
aseConfigLocation
()
{
public
void
b
aseConfigLocation
()
{
this
.
initializer
.
initialize
(
this
.
context
.
getEnvironment
(),
this
.
context
.
getClassLoader
());
this
.
logger
.
info
(
"Hello world"
);
...
...
@@ -97,7 +97,7 @@ public class LoggingApplicationListenerTests {
}
@Test
public
void
testO
verrideConfigLocation
()
{
public
void
o
verrideConfigLocation
()
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"logging.config: classpath:logback-nondefault.xml"
);
this
.
initializer
.
initialize
(
this
.
context
.
getEnvironment
(),
...
...
@@ -110,7 +110,7 @@ public class LoggingApplicationListenerTests {
}
@Test
public
void
testO
verrideConfigDoesNotExist
()
throws
Exception
{
public
void
o
verrideConfigDoesNotExist
()
throws
Exception
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"logging.config: doesnotexist.xml"
);
this
.
initializer
.
initialize
(
this
.
context
.
getEnvironment
(),
...
...
@@ -119,7 +119,7 @@ public class LoggingApplicationListenerTests {
}
@Test
public
void
testA
ddLogFileProperty
()
{
public
void
a
ddLogFileProperty
()
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"logging.config: classpath:logback-nondefault.xml"
,
"logging.file: target/foo.log"
);
...
...
@@ -132,7 +132,7 @@ public class LoggingApplicationListenerTests {
}
@Test
public
void
testA
ddLogFilePropertyWithDefault
()
{
public
void
a
ddLogFilePropertyWithDefault
()
{
assertFalse
(
new
File
(
"target/foo.log"
).
exists
());
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"logging.file: target/foo.log"
);
this
.
initializer
.
initialize
(
this
.
context
.
getEnvironment
(),
...
...
@@ -143,7 +143,7 @@ public class LoggingApplicationListenerTests {
}
@Test
public
void
testA
ddLogPathProperty
()
{
public
void
a
ddLogPathProperty
()
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"logging.config: classpath:logback-nondefault.xml"
,
"logging.path: target/foo/"
);
...
...
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