diff --git a/framework-docs/framework-docs.gradle b/framework-docs/framework-docs.gradle index 9c63ab4129..8b205123bf 100644 --- a/framework-docs/framework-docs.gradle +++ b/framework-docs/framework-docs.gradle @@ -41,6 +41,13 @@ repositories { } } +// To avoid a redeclaration error with Kotlin compiler +sourceSets { + main { + java.exclude("org/springframework/docs/**/*.java") + } +} + dependencies { api(project(":spring-aspects")) api(project(":spring-context")) @@ -68,6 +75,7 @@ dependencies { api("org.aspectj:aspectjweaver") api("org.eclipse.jetty.websocket:jetty-websocket-jetty-api") api("org.jetbrains.kotlin:kotlin-stdlib") + api("jakarta.websocket:jakarta.websocket-api") implementation(project(":spring-core-test")) implementation("org.assertj:assertj-core") diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/core/beans/dependencies/beansfactorylazyinit/AnotherBean.kt b/framework-docs/src/main/kotlin/org/springframework/docs/core/beans/dependencies/beansfactorylazyinit/AnotherBean.kt new file mode 100644 index 0000000000..322698b06f --- /dev/null +++ b/framework-docs/src/main/kotlin/org/springframework/docs/core/beans/dependencies/beansfactorylazyinit/AnotherBean.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2002-2024 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.docs.core.beans.dependencies.beansfactorylazyinit + +class AnotherBean { +} \ No newline at end of file diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/core/beans/dependencies/beansfactorylazyinit/ExpensiveToCreateBean.kt b/framework-docs/src/main/kotlin/org/springframework/docs/core/beans/dependencies/beansfactorylazyinit/ExpensiveToCreateBean.kt new file mode 100644 index 0000000000..b70d3a9225 --- /dev/null +++ b/framework-docs/src/main/kotlin/org/springframework/docs/core/beans/dependencies/beansfactorylazyinit/ExpensiveToCreateBean.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2002-2024 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.docs.core.beans.dependencies.beansfactorylazyinit + +class ExpensiveToCreateBean { +} \ No newline at end of file diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/core/expressions/expressionsbeandef/CustomerPreferenceDao.kt b/framework-docs/src/main/kotlin/org/springframework/docs/core/expressions/expressionsbeandef/CustomerPreferenceDao.kt new file mode 100644 index 0000000000..75c4d4a321 --- /dev/null +++ b/framework-docs/src/main/kotlin/org/springframework/docs/core/expressions/expressionsbeandef/CustomerPreferenceDao.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2002-2024 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.docs.core.expressions.expressionsbeandef + +class CustomerPreferenceDao { +} \ No newline at end of file diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/core/expressions/expressionsbeandef/MovieFinder.kt b/framework-docs/src/main/kotlin/org/springframework/docs/core/expressions/expressionsbeandef/MovieFinder.kt new file mode 100644 index 0000000000..d49fa29a39 --- /dev/null +++ b/framework-docs/src/main/kotlin/org/springframework/docs/core/expressions/expressionsbeandef/MovieFinder.kt @@ -0,0 +1,21 @@ +/* + * Copyright 2002-2024 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.springframework.docs.core.expressions.expressionsbeandef + +class MovieFinder { +} \ No newline at end of file diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/dataaccess/jdbc/jdbccomplextypes/TestItem.kt b/framework-docs/src/main/kotlin/org/springframework/docs/dataaccess/jdbc/jdbccomplextypes/TestItem.kt new file mode 100644 index 0000000000..ef93410bb2 --- /dev/null +++ b/framework-docs/src/main/kotlin/org/springframework/docs/dataaccess/jdbc/jdbccomplextypes/TestItem.kt @@ -0,0 +1,21 @@ +/* + * Copyright 2002-2024 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.docs.dataaccess.jdbc.jdbccomplextypes + +import java.util.Date + +data class TestItem(val id: Long, val description: String, val expirationDate: Date) \ No newline at end of file diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/dataaccess/jdbc/jdbccomplextypes/TestItemStoredProcedure.kt b/framework-docs/src/main/kotlin/org/springframework/docs/dataaccess/jdbc/jdbccomplextypes/TestItemStoredProcedure.kt index ac0c648ba6..5cdfb06bf3 100644 --- a/framework-docs/src/main/kotlin/org/springframework/docs/dataaccess/jdbc/jdbccomplextypes/TestItemStoredProcedure.kt +++ b/framework-docs/src/main/kotlin/org/springframework/docs/dataaccess/jdbc/jdbccomplextypes/TestItemStoredProcedure.kt @@ -31,11 +31,11 @@ class TestItemStoredProcedure(dataSource: DataSource) : StoredProcedure(dataSour cs: CallableStatement, colIndx: Int, _: Int, _: String? -> val struct = cs.getObject(colIndx) as Struct val attr = struct.attributes - val item = TestItem() - item.id = (attr[0] as Number).toLong() - item.description = attr[1] as String - item.expirationDate = attr[2] as Date - item + TestItem( + (attr[0] as Number).toLong(), + attr[1] as String, + attr[2] as Date + ) }) // ... } diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/dataaccess/jdbc/jdbcjdbctemplateidioms/CorporateEventDao.kt b/framework-docs/src/main/kotlin/org/springframework/docs/dataaccess/jdbc/jdbcjdbctemplateidioms/CorporateEventDao.kt new file mode 100644 index 0000000000..e73c56c373 --- /dev/null +++ b/framework-docs/src/main/kotlin/org/springframework/docs/dataaccess/jdbc/jdbcjdbctemplateidioms/CorporateEventDao.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2002-2024 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.docs.dataaccess.jdbc.jdbcjdbctemplateidioms + +interface CorporateEventDao { +} \ No newline at end of file diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/integration/jmx/jmxexporting/IJmxTestBean.kt b/framework-docs/src/main/kotlin/org/springframework/docs/integration/jmx/jmxexporting/IJmxTestBean.kt new file mode 100644 index 0000000000..b82b4c1d9c --- /dev/null +++ b/framework-docs/src/main/kotlin/org/springframework/docs/integration/jmx/jmxexporting/IJmxTestBean.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2002-2024 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.docs.integration.jmx.jmxexporting + +interface IJmxTestBean { + + var name: String + var age: Int + fun add(x: Int, y: Int): Int + fun dontExposeMe() +} \ No newline at end of file diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/integration/jmx/jmxexporting/JmxTestBean.kt b/framework-docs/src/main/kotlin/org/springframework/docs/integration/jmx/jmxexporting/JmxTestBean.kt index a4936ed4d9..07ae48ed5c 100644 --- a/framework-docs/src/main/kotlin/org/springframework/docs/integration/jmx/jmxexporting/JmxTestBean.kt +++ b/framework-docs/src/main/kotlin/org/springframework/docs/integration/jmx/jmxexporting/JmxTestBean.kt @@ -19,24 +19,8 @@ package org.springframework.docs.integration.jmx.jmxexporting // tag::snippet[] class JmxTestBean : IJmxTestBean { - private lateinit var name: String - private var age = 0 - - override fun getAge(): Int { - return age - } - - override fun setAge(age: Int) { - this.age = age - } - - override fun setName(name: String) { - this.name = name - } - - override fun getName(): String { - return name - } + override lateinit var name: String + override var age = 0 override fun add(x: Int, y: Int): Int { return x + y diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/integration/mailusagesimple/Customer.kt b/framework-docs/src/main/kotlin/org/springframework/docs/integration/mailusagesimple/Customer.kt new file mode 100644 index 0000000000..b42c891f76 --- /dev/null +++ b/framework-docs/src/main/kotlin/org/springframework/docs/integration/mailusagesimple/Customer.kt @@ -0,0 +1,23 @@ +/* + * Copyright 2002-2024 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.docs.integration.mailusagesimple + +data class Customer( + val emailAddress: String, + val firstName: String, + val lastName: String +) \ No newline at end of file diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/integration/mailusagesimple/Order.kt b/framework-docs/src/main/kotlin/org/springframework/docs/integration/mailusagesimple/Order.kt new file mode 100644 index 0000000000..ba20e8eee1 --- /dev/null +++ b/framework-docs/src/main/kotlin/org/springframework/docs/integration/mailusagesimple/Order.kt @@ -0,0 +1,22 @@ +/* + * Copyright 2002-2024 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.docs.integration.mailusagesimple + +data class Order( + val customer: Customer, + val orderNumber: String +) \ No newline at end of file diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/testing/mockmvc/assertj/mockmvctestersetup/AccountController.kt b/framework-docs/src/main/kotlin/org/springframework/docs/testing/mockmvc/assertj/mockmvctestersetup/AccountController.kt new file mode 100644 index 0000000000..5328cfd2c0 --- /dev/null +++ b/framework-docs/src/main/kotlin/org/springframework/docs/testing/mockmvc/assertj/mockmvctestersetup/AccountController.kt @@ -0,0 +1,23 @@ +/* + * Copyright 2002-2024 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.docs.testing.mockmvc.assertj.mockmvctestersetup + +import org.springframework.web.bind.annotation.RestController + +@RestController +class AccountController { +} \ No newline at end of file diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/testing/mockmvc/assertj/mockmvctestersetup/ApplicationWebConfiguration.kt b/framework-docs/src/main/kotlin/org/springframework/docs/testing/mockmvc/assertj/mockmvctestersetup/ApplicationWebConfiguration.kt new file mode 100644 index 0000000000..97d474d245 --- /dev/null +++ b/framework-docs/src/main/kotlin/org/springframework/docs/testing/mockmvc/assertj/mockmvctestersetup/ApplicationWebConfiguration.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2002-2024 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.docs.testing.mockmvc.assertj.mockmvctestersetup + +import org.springframework.context.annotation.Configuration +import org.springframework.web.servlet.config.annotation.EnableWebMvc + +@Configuration(proxyBeanMethods = false) +@EnableWebMvc +class ApplicationWebConfiguration { +} \ No newline at end of file diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigvalidation/FooValidator.kt b/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigvalidation/FooValidator.kt new file mode 100644 index 0000000000..ed19b4f0a6 --- /dev/null +++ b/framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcconfig/mvcconfigvalidation/FooValidator.kt @@ -0,0 +1,27 @@ +/* + * Copyright 2002-2024 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.docs.web.webmvc.mvcconfig.mvcconfigvalidation + +import org.springframework.validation.Errors +import org.springframework.validation.Validator + +class FooValidator : Validator { + override fun supports(clazz: Class<*>) = false + + override fun validate(target: Any, errors: Errors) { + } +} \ No newline at end of file diff --git a/framework-docs/src/main/kotlin/org/springframework/docs/web/websocket/websocketserverruntimeconfiguration/MyEchoHandler.kt b/framework-docs/src/main/kotlin/org/springframework/docs/web/websocket/websocketserverruntimeconfiguration/MyEchoHandler.kt new file mode 100644 index 0000000000..e859cbba19 --- /dev/null +++ b/framework-docs/src/main/kotlin/org/springframework/docs/web/websocket/websocketserverruntimeconfiguration/MyEchoHandler.kt @@ -0,0 +1,22 @@ +/* + * Copyright 2002-2024 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.docs.web.websocket.websocketserverruntimeconfiguration + +import org.springframework.web.socket.handler.AbstractWebSocketHandler + +class MyEchoHandler : AbstractWebSocketHandler() { +} \ No newline at end of file