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
e28b98c5
Commit
e28b98c5
authored
Nov 02, 2017
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove multi config runApplication extension
Closes gh-10511
parent
944216e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
49 deletions
+0
-49
SpringApplicationExtensions.kt
...n/org/springframework/boot/SpringApplicationExtensions.kt
+0
-13
SpringApplicationExtensionsTests.kt
.../springframework/boot/SpringApplicationExtensionsTests.kt
+0
-36
No files found.
spring-boot-project/spring-boot/src/main/kotlin/org/springframework/boot/SpringApplicationExtensions.kt
View file @
e28b98c5
...
@@ -42,16 +42,3 @@ inline fun <reified T : Any> runApplication(vararg args: String): ConfigurableAp
...
@@ -42,16 +42,3 @@ inline fun <reified T : Any> runApplication(vararg args: String): ConfigurableAp
*/
*/
inline
fun
<
reified
T
:
Any
>
runApplication
(
vararg
args
:
String
,
init
:
SpringApplication
.()
->
Unit
):
ConfigurableApplicationContext
=
inline
fun
<
reified
T
:
Any
>
runApplication
(
vararg
args
:
String
,
init
:
SpringApplication
.()
->
Unit
):
ConfigurableApplicationContext
=
SpringApplication
(
T
::
class
.
java
).
apply
(
init
).
run
(*
args
)
SpringApplication
(
T
::
class
.
java
).
apply
(
init
).
run
(*
args
)
/**
* Top level function acting as a Kotlin shortcut allowing to write
* `runApplication(arrayOf(FooApplication::class, FooConfiguration::class), arg1, arg2) { // Optional SpringApplication customization ... }`
* instead of instantiating `SpringApplication` class, customize it and then invoking
* `run(arrayOf(arg1, arg2))`.`
*
* @author Sebastien Deleuze
* @since 2.0.0
*/
fun
runApplication
(
primarySources
:
Array
<
KClass
<*
>>,
vararg
args
:
String
,
init
:
SpringApplication
.()
->
Unit
=
{}):
ConfigurableApplicationContext
=
SpringApplication
(*
primarySources
.
map
{
it
.
java
}.
toTypedArray
()).
apply
(
init
).
run
(*
args
)
spring-boot-project/spring-boot/src/test/kotlin/org/springframework/boot/SpringApplicationExtensionsTests.kt
View file @
e28b98c5
...
@@ -70,42 +70,6 @@ class SpringApplicationExtensionsTests {
...
@@ -70,42 +70,6 @@ class SpringApplicationExtensionsTests {
assertEquals
(
environment
,
context
.
environment
)
assertEquals
(
environment
,
context
.
environment
)
}
}
@Test
fun
`
Kotlin
runApplication
(
array
of
KClass
)
top
level
function
`
()
{
val
context
=
runApplication
(
arrayOf
(
ExampleConfig
::
class
,
ExampleWebConfig
::
class
))
assertNotNull
(
context
)
}
@Test
fun
`
Kotlin
runApplication
(
array
of
KClass
)
top
level
function
with
a
custom
environment
`
()
{
val
environment
=
StandardEnvironment
()
val
context
=
runApplication
(
arrayOf
(
ExampleConfig
::
class
,
ExampleWebConfig
::
class
))
{
setEnvironment
(
environment
)
}
assertNotNull
(
context
)
assertEquals
(
environment
,
context
.
environment
)
}
@Test
fun
`
Kotlin
runApplication
(
array
of
KClass
,
arg1
,
arg2
)
top
level
function
`
()
{
val
context
=
runApplication
(
arrayOf
(
ExampleConfig
::
class
,
ExampleWebConfig
::
class
),
"--debug"
,
"spring"
,
"boot"
)
val
args
=
context
.
getBean
<
ApplicationArguments
>()
assertArrayEquals
(
arrayOf
(
"spring"
,
"boot"
),
args
.
nonOptionArgs
.
toTypedArray
())
assertTrue
(
args
.
containsOption
(
"debug"
))
}
@Test
fun
`
Kotlin
runApplication
(
array
of
KClass
,
arg1
,
arg2
)
top
level
function
with
a
custom
environment
`
()
{
val
environment
=
StandardEnvironment
()
val
context
=
runApplication
(
arrayOf
(
ExampleConfig
::
class
,
ExampleWebConfig
::
class
),
"--debug"
,
"spring"
,
"boot"
)
{
setEnvironment
(
environment
)
}
val
args
=
context
.
getBean
<
ApplicationArguments
>()
assertArrayEquals
(
arrayOf
(
"spring"
,
"boot"
),
args
.
nonOptionArgs
.
toTypedArray
())
assertTrue
(
args
.
containsOption
(
"debug"
))
assertEquals
(
environment
,
context
.
environment
)
}
@Configuration
@Configuration
internal
open
class
ExampleConfig
internal
open
class
ExampleConfig
...
...
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