Skip to content

Commit a93ad0f

Browse files
committed
Merge branch '4.0.x'
Closes gh-49715
2 parents 59bcfbd + bcd5b28 commit a93ad0f

8 files changed

Lines changed: 108 additions & 15 deletions

File tree

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/features/kotlin.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ javadoc:org.springframework.boot.context.properties.ConfigurationProperties[form
115115
data class KotlinExampleProperties(
116116
val name: String,
117117
val description: String,
118-
val myService: MyService) {
118+
val myService: MyService
119+
) {
119120
120121
data class MyService(
121122
val apiToken: String,

documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/servlet/springmvc/errorhandling/errorpages/MyErrorViewResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public ModelAndView resolveErrorView(HttpServletRequest request, HttpStatus stat
3131
// Use the request or status to optionally return a ModelAndView
3232
if (status == HttpStatus.INSUFFICIENT_STORAGE) {
3333
// We could add custom model values here
34-
new ModelAndView("myview");
34+
return new ModelAndView("myview");
3535
}
3636
return null;
3737
}

documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/developingautoconfiguration/testing/MyConditionEvaluationReportingTests.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ class MyConditionEvaluationReportingTests {
2929
fun autoConfigTest() {
3030
ApplicationContextRunner()
3131
.withInitializer(ConditionEvaluationReportLoggingListener.forLogLevel(LogLevel.INFO))
32-
.run { context: AssertableApplicationContext? -> }
32+
.run { context: AssertableApplicationContext? ->
33+
// Test something...
34+
}
3335
}
3436

3537
}
36-

documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/devtools/restart/disable/MyApplication.kt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,13 @@
1616

1717
package org.springframework.boot.docs.using.devtools.restart.disable
1818

19-
import org.springframework.boot.SpringApplication
2019
import org.springframework.boot.autoconfigure.SpringBootApplication
20+
import org.springframework.boot.runApplication
2121

2222
@SpringBootApplication
23-
object MyApplication {
24-
25-
@JvmStatic
26-
fun main(args: Array<String>) {
27-
System.setProperty("spring.devtools.restart.enabled", "false")
28-
SpringApplication.run(MyApplication::class.java, *args)
29-
}
23+
class MyApplication
3024

25+
fun main(args: Array<String>) {
26+
System.setProperty("spring.devtools.restart.enabled", "false")
27+
runApplication<MyApplication>(*args)
3128
}
32-

documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/using/usingthespringbootapplicationannotation/springapplication/MyApplication.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ package org.springframework.boot.docs.using.usingthespringbootapplicationannotat
1919
import org.springframework.boot.autoconfigure.SpringBootApplication
2020
import org.springframework.boot.runApplication
2121

22-
// same as @SpringBootConfiguration @EnableAutoConfiguration @ComponentScan
22+
// Same as @SpringBootConfiguration @EnableAutoConfiguration @ComponentScan
2323
@SpringBootApplication
2424
class MyApplication
2525

2626
fun main(args: Array<String>) {
2727
runApplication<MyApplication>(*args)
2828
}
29-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2012-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.docs.web.servlet.embeddedcontainer.applicationcontext
18+
19+
import jakarta.servlet.ServletContext
20+
import org.springframework.boot.context.event.ApplicationStartedEvent
21+
import org.springframework.context.ApplicationContext
22+
import org.springframework.context.ApplicationListener
23+
import org.springframework.web.context.WebApplicationContext
24+
25+
class MyDemoBean : ApplicationListener<ApplicationStartedEvent> {
26+
27+
@Suppress("unused")
28+
private var servletContext: ServletContext? = null
29+
30+
override fun onApplicationEvent(event: ApplicationStartedEvent) {
31+
val applicationContext: ApplicationContext = event.applicationContext
32+
this.servletContext = (applicationContext as WebApplicationContext).servletContext
33+
}
34+
35+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright 2012-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.docs.web.servlet.jersey
18+
19+
import jakarta.ws.rs.GET
20+
import jakarta.ws.rs.Path
21+
import org.springframework.stereotype.Component
22+
23+
@Component
24+
@Path("/hello")
25+
class MyEndpoint {
26+
27+
@GET
28+
fun message(): String {
29+
return "Hello"
30+
}
31+
32+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2012-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.docs.web.servlet.jersey
18+
19+
import org.glassfish.jersey.server.ResourceConfig
20+
import org.springframework.stereotype.Component
21+
22+
@Component
23+
class MyJerseyConfig : ResourceConfig() {
24+
25+
init {
26+
register(MyEndpoint::class.java)
27+
}
28+
29+
}

0 commit comments

Comments
 (0)