parent
a3615f4f77
commit
4f8558f568
|
|
@ -16,6 +16,13 @@
|
|||
|
||||
package org.springframework.boot.docs.actuator.cloudfoundry.customcontextpath
|
||||
|
||||
import jakarta.servlet.GenericServlet
|
||||
import jakarta.servlet.Servlet
|
||||
import jakarta.servlet.ServletContainerInitializer
|
||||
import jakarta.servlet.ServletContext
|
||||
import jakarta.servlet.ServletException
|
||||
import jakarta.servlet.ServletRequest
|
||||
import jakarta.servlet.ServletResponse
|
||||
import org.apache.catalina.Host
|
||||
import org.apache.catalina.core.StandardContext
|
||||
import org.apache.catalina.startup.Tomcat.FixContextListener
|
||||
|
|
@ -25,14 +32,6 @@ import org.springframework.context.annotation.Bean
|
|||
import org.springframework.context.annotation.Configuration
|
||||
import java.io.IOException
|
||||
import java.util.Collections.emptySet
|
||||
import javax.servlet.GenericServlet
|
||||
import javax.servlet.Servlet
|
||||
import javax.servlet.ServletContainerInitializer
|
||||
import javax.servlet.ServletContext
|
||||
import javax.servlet.ServletException
|
||||
import javax.servlet.ServletRequest
|
||||
import javax.servlet.ServletResponse
|
||||
import kotlin.jvm.Throws
|
||||
|
||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import org.springframework.boot.loader.tools.LibraryScope
|
|||
import org.springframework.boot.loader.tools.Repackager
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import kotlin.jvm.Throws
|
||||
|
||||
class MyBuildTool {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
package org.springframework.boot.docs.data.sql.jpaandspringdata.entityclasses
|
||||
|
||||
import jakarta.persistence.Column
|
||||
import jakarta.persistence.Entity
|
||||
import jakarta.persistence.GeneratedValue
|
||||
import jakarta.persistence.Id
|
||||
import java.io.Serializable
|
||||
import javax.persistence.Column
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.GeneratedValue
|
||||
import javax.persistence.Id
|
||||
|
||||
@Entity
|
||||
class City : Serializable {
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@
|
|||
|
||||
package org.springframework.boot.docs.data.sql.jpaandspringdata.entityclasses
|
||||
|
||||
import jakarta.persistence.Column
|
||||
import jakarta.persistence.Entity
|
||||
import jakarta.persistence.GeneratedValue
|
||||
import jakarta.persistence.Id
|
||||
import org.hibernate.envers.Audited
|
||||
import java.io.Serializable
|
||||
import javax.persistence.Column
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.GeneratedValue
|
||||
import javax.persistence.Id
|
||||
|
||||
@Entity
|
||||
class Country : Serializable {
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
|
||||
package org.springframework.boot.docs.features.externalconfig.typesafeconfigurationproperties.validate
|
||||
|
||||
import jakarta.validation.constraints.NotNull
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import java.net.InetAddress
|
||||
import javax.validation.constraints.NotNull
|
||||
|
||||
@ConfigurationProperties("my.service")
|
||||
@Validated
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@
|
|||
|
||||
package org.springframework.boot.docs.features.externalconfig.typesafeconfigurationproperties.validate.nested
|
||||
|
||||
import jakarta.validation.Valid
|
||||
import jakarta.validation.constraints.NotEmpty
|
||||
import jakarta.validation.constraints.NotNull
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import java.net.InetAddress
|
||||
import javax.validation.Valid
|
||||
import javax.validation.constraints.NotEmpty
|
||||
import javax.validation.constraints.NotNull
|
||||
|
||||
@ConfigurationProperties("my.service")
|
||||
@Validated
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
|
||||
package org.springframework.boot.docs.features.externalconfig.typesafeconfigurationproperties.validation
|
||||
|
||||
import jakarta.validation.constraints.NotNull
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import java.net.InetAddress
|
||||
import javax.validation.constraints.NotNull
|
||||
|
||||
@ConfigurationProperties("my.service")
|
||||
@Validated
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@
|
|||
|
||||
package org.springframework.boot.docs.features.externalconfig.typesafeconfigurationproperties.validation.nested
|
||||
|
||||
import jakarta.validation.Valid
|
||||
import jakarta.validation.constraints.NotEmpty
|
||||
import jakarta.validation.constraints.NotNull
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import java.net.InetAddress
|
||||
import javax.validation.Valid
|
||||
import javax.validation.constraints.NotEmpty
|
||||
import javax.validation.constraints.NotNull
|
||||
|
||||
@ConfigurationProperties("my.service")
|
||||
@Validated
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package org.springframework.boot.docs.features.testing.springbootapplications.au
|
|||
|
||||
import org.springframework.boot.test.autoconfigure.restdocs.RestDocsRestAssuredConfigurationCustomizer
|
||||
import org.springframework.boot.test.context.TestConfiguration
|
||||
import org.springframework.restdocs.restassured3.RestAssuredRestDocumentationConfigurer
|
||||
import org.springframework.restdocs.restassured.RestAssuredRestDocumentationConfigurer
|
||||
import org.springframework.restdocs.templates.TemplateFormats
|
||||
|
||||
@TestConfiguration(proxyBeanMethods = false)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDoc
|
|||
import org.springframework.boot.test.context.SpringBootTest
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment
|
||||
import org.springframework.boot.web.server.LocalServerPort
|
||||
import org.springframework.restdocs.restassured3.RestAssuredRestDocumentation
|
||||
import org.springframework.restdocs.restassured.RestAssuredRestDocumentation
|
||||
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
@AutoConfigureRestDocs
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.springframework.boot.docs.features.testing.springbootapplications.autoconfiguredwebservices.client
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement
|
||||
import jakarta.xml.bind.annotation.XmlRootElement
|
||||
|
||||
@XmlRootElement(name = "request")
|
||||
class Request
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
package org.springframework.boot.docs.features.testing.springbootapplications.autoconfiguredwebservices.client
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType
|
||||
import javax.xml.bind.annotation.XmlAccessorType
|
||||
import javax.xml.bind.annotation.XmlRootElement
|
||||
import jakarta.xml.bind.annotation.XmlAccessType
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType
|
||||
import jakarta.xml.bind.annotation.XmlRootElement
|
||||
|
||||
@XmlRootElement(name = "response")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
|
|
|
|||
|
|
@ -16,11 +16,12 @@
|
|||
|
||||
package org.springframework.boot.docs.features.testing.springbootapplications.autoconfiguredwebservices.server
|
||||
|
||||
import javax.xml.transform.Source
|
||||
|
||||
import org.springframework.ws.server.endpoint.annotation.Endpoint
|
||||
import org.springframework.ws.server.endpoint.annotation.PayloadRoot
|
||||
import org.springframework.ws.server.endpoint.annotation.ResponsePayload
|
||||
import org.springframework.xml.transform.StringSource
|
||||
import javax.xml.transform.Source
|
||||
|
||||
@Endpoint
|
||||
class ExampleEndpoint {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.boot.docs.features.testing.springbootapplications.jmx
|
||||
|
||||
import javax.management.MBeanServer
|
||||
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.extension.ExtendWith
|
||||
|
|
@ -23,7 +25,6 @@ import org.springframework.beans.factory.annotation.Autowired
|
|||
import org.springframework.boot.test.context.SpringBootTest
|
||||
import org.springframework.test.annotation.DirtiesContext
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension
|
||||
import javax.management.MBeanServer
|
||||
|
||||
@ExtendWith(SpringExtension::class)
|
||||
@SpringBootTest(properties = ["spring.jmx.enabled=true"])
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012-2022 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.boot.docs.features.testing.springbootapplications.springgraphqltests
|
||||
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.boot.docs.web.graphql.runtimewiring.GreetingController
|
||||
import org.springframework.boot.test.autoconfigure.graphql.GraphQlTest
|
||||
import org.springframework.graphql.test.tester.GraphQlTester
|
||||
|
||||
@GraphQlTest(GreetingController::class)
|
||||
internal class GreetingControllerTests {
|
||||
|
||||
@Autowired
|
||||
lateinit var graphQlTester: GraphQlTester
|
||||
|
||||
@Test
|
||||
fun shouldGreetWithSpecificName() {
|
||||
graphQlTester.query("{ greeting(name: \"Alice\") } ").execute().path("greeting").entity(String::class.java)
|
||||
.isEqualTo("Hello, Alice!")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun shouldGreetWithDefaultName() {
|
||||
graphQlTester.query("{ greeting } ").execute().path("greeting").entity(String::class.java)
|
||||
.isEqualTo("Hello, Spring!")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -16,11 +16,12 @@
|
|||
|
||||
package org.springframework.boot.docs.howto.dataaccess.configurecustomdatasource.builder
|
||||
|
||||
import javax.sql.DataSource
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import javax.sql.DataSource
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class MyDataSourceConfiguration {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.boot.docs.howto.dataaccess.usemultipleentitymanagers
|
||||
|
||||
import javax.sql.DataSource
|
||||
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder
|
||||
|
|
@ -24,7 +26,6 @@ import org.springframework.context.annotation.Configuration
|
|||
import org.springframework.orm.jpa.JpaVendorAdapter
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
|
||||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter
|
||||
import javax.sql.DataSource
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012-2022 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.boot.docs.howto.jersey.alongsideanotherwebframework
|
||||
|
||||
class Endpoint
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012-2022 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.boot.docs.howto.jersey.alongsideanotherwebframework
|
||||
|
||||
import org.glassfish.jersey.server.ResourceConfig
|
||||
import org.glassfish.jersey.servlet.ServletProperties
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
@Component
|
||||
class JerseyConfig : ResourceConfig() {
|
||||
|
||||
init {
|
||||
register(Endpoint::class.java)
|
||||
property(ServletProperties.FILTER_FORWARD_ON_404, true)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012-2022 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.boot.docs.howto.jersey.springsecurity
|
||||
|
||||
class Endpoint
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012-2022 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.boot.docs.howto.jersey.springsecurity
|
||||
|
||||
import org.glassfish.jersey.server.ResourceConfig
|
||||
import org.springframework.stereotype.Component
|
||||
import java.util.Collections
|
||||
|
||||
@Component
|
||||
class JerseySetStatusOverSendErrorConfig : ResourceConfig() {
|
||||
|
||||
init {
|
||||
register(Endpoint::class.java)
|
||||
setProperties(Collections.singletonMap("jersey.config.server.response.setStatusOverSendError", true))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
package org.springframework.boot.docs.howto.messaging.disabletransactedjmssession
|
||||
|
||||
import jakarta.jms.ConnectionFactory
|
||||
import org.springframework.boot.autoconfigure.jms.DefaultJmsListenerContainerFactoryConfigurer
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.jms.config.DefaultJmsListenerContainerFactory
|
||||
import javax.jms.ConnectionFactory
|
||||
|
||||
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.springframework.boot.docs.howto.springmvc.writexmlrestservice
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement
|
||||
import jakarta.xml.bind.annotation.XmlRootElement
|
||||
|
||||
@XmlRootElement
|
||||
class MyThing {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@
|
|||
|
||||
package org.springframework.boot.docs.howto.webserver.addservletfilterlistener.springbean.disable
|
||||
|
||||
import javax.servlet.Filter
|
||||
import jakarta.servlet.Filter
|
||||
|
||||
abstract class MyFilter : Filter
|
||||
|
|
|
|||
|
|
@ -17,13 +17,10 @@
|
|||
package org.springframework.boot.docs.howto.webserver.enablemultipleconnectorsintomcat
|
||||
|
||||
import org.apache.catalina.connector.Connector
|
||||
import org.apache.coyote.http11.Http11NioProtocol
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory
|
||||
import org.springframework.boot.web.server.WebServerFactoryCustomizer
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.util.ResourceUtils
|
||||
import java.io.IOException
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class MyTomcatConfiguration {
|
||||
|
|
@ -31,31 +28,14 @@ class MyTomcatConfiguration {
|
|||
@Bean
|
||||
fun sslConnectorCustomizer(): WebServerFactoryCustomizer<TomcatServletWebServerFactory> {
|
||||
return WebServerFactoryCustomizer { tomcat: TomcatServletWebServerFactory ->
|
||||
tomcat.addAdditionalTomcatConnectors(
|
||||
createSslConnector()
|
||||
)
|
||||
tomcat.addAdditionalTomcatConnectors(createConnectorConnector())
|
||||
}
|
||||
}
|
||||
|
||||
private fun createSslConnector(): Connector {
|
||||
private fun createConnectorConnector(): Connector {
|
||||
val connector = Connector("org.apache.coyote.http11.Http11NioProtocol")
|
||||
val protocol = connector.protocolHandler as Http11NioProtocol
|
||||
return try {
|
||||
val keystore = ResourceUtils.getURL("keystore")
|
||||
val truststore = ResourceUtils.getURL("truststore")
|
||||
connector.scheme = "https"
|
||||
connector.secure = true
|
||||
connector.port = 8443
|
||||
protocol.isSSLEnabled = true
|
||||
protocol.keystoreFile = keystore.toString()
|
||||
protocol.keystorePass = "changeit"
|
||||
protocol.truststoreFile = truststore.toString()
|
||||
protocol.truststorePass = "changeit"
|
||||
protocol.keyAlias = "apitester"
|
||||
connector
|
||||
} catch (ex: IOException) {
|
||||
throw IllegalStateException("Fail to create ssl connector", ex)
|
||||
}
|
||||
connector.port = 8080
|
||||
return connector
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
package org.springframework.boot.docs.io.jta.mixingxaandnonxaconnections.nonxa
|
||||
|
||||
import jakarta.jms.ConnectionFactory
|
||||
import org.springframework.beans.factory.annotation.Qualifier
|
||||
import javax.jms.ConnectionFactory
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
class MyBean(@Qualifier("nonXaJmsConnectionFactory") connectionFactory: ConnectionFactory?)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.springframework.boot.docs.io.jta.mixingxaandnonxaconnections.primary
|
||||
|
||||
import javax.jms.ConnectionFactory
|
||||
import jakarta.jms.ConnectionFactory
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
class MyBean(connectionFactory: ConnectionFactory?)
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
package org.springframework.boot.docs.io.jta.mixingxaandnonxaconnections.xa
|
||||
|
||||
import jakarta.jms.ConnectionFactory
|
||||
import org.springframework.beans.factory.annotation.Qualifier
|
||||
import javax.jms.ConnectionFactory
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
class MyBean(@Qualifier("xaJmsConnectionFactory") connectionFactory: ConnectionFactory?)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import org.apache.http.protocol.HttpContext
|
|||
import org.springframework.boot.web.client.RestTemplateCustomizer
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory
|
||||
import org.springframework.web.client.RestTemplate
|
||||
import kotlin.jvm.Throws
|
||||
|
||||
class MyRestTemplateCustomizer : RestTemplateCustomizer {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
package org.springframework.boot.docs.io.validation
|
||||
|
||||
import jakarta.validation.constraints.Size
|
||||
import org.springframework.stereotype.Service
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import javax.validation.constraints.Size
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
@Service
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
package org.springframework.boot.docs.messaging.jms.receiving.custom
|
||||
|
||||
import jakarta.jms.ConnectionFactory
|
||||
import org.springframework.boot.autoconfigure.jms.DefaultJmsListenerContainerFactoryConfigurer
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.jms.config.DefaultJmsListenerContainerFactory
|
||||
import javax.jms.ConnectionFactory
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class MyJmsConfiguration {
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
package org.springframework.boot.docs.messaging.jms.receiving.custom
|
||||
|
||||
import jakarta.jms.Message
|
||||
import jakarta.jms.Session
|
||||
import org.springframework.jms.support.converter.MessageConverter
|
||||
import javax.jms.Message
|
||||
import javax.jms.Session
|
||||
|
||||
internal class MyMessageConverter : MessageConverter {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012-2022 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.boot.docs.web.graphql.runtimewiring;
|
||||
|
||||
import org.springframework.graphql.data.method.annotation.Argument
|
||||
import org.springframework.graphql.data.method.annotation.QueryMapping
|
||||
import org.springframework.stereotype.Controller
|
||||
|
||||
@Controller
|
||||
class GreetingController {
|
||||
|
||||
@QueryMapping
|
||||
fun greeting(@Argument name: String): String {
|
||||
return "Hello, $name!"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012-2022 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.boot.docs.web.servlet.jersey
|
||||
|
||||
import org.springframework.stereotype.Component
|
||||
import javax.ws.rs.GET
|
||||
import javax.ws.rs.Path
|
||||
|
||||
@Component
|
||||
@Path("/hello")
|
||||
class MyEndpoint {
|
||||
|
||||
@GET
|
||||
fun message(): String {
|
||||
return "Hello"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012-2022 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.boot.docs.web.servlet.jersey
|
||||
|
||||
import org.glassfish.jersey.server.ResourceConfig
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
@Component
|
||||
class MyJerseyConfig : ResourceConfig() {
|
||||
|
||||
init {
|
||||
register(MyEndpoint::class.java)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -16,10 +16,10 @@
|
|||
|
||||
package org.springframework.boot.docs.web.servlet.springmvc.errorhandling
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest
|
||||
import org.springframework.boot.web.servlet.error.ErrorAttributes
|
||||
import org.springframework.stereotype.Controller
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler
|
||||
import javax.servlet.http.HttpServletRequest
|
||||
|
||||
@Controller
|
||||
class MyController {
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@
|
|||
|
||||
package org.springframework.boot.docs.web.servlet.springmvc.errorhandling
|
||||
|
||||
import jakarta.servlet.RequestDispatcher
|
||||
import jakarta.servlet.http.HttpServletRequest
|
||||
import org.springframework.http.HttpStatus
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler
|
||||
import org.springframework.web.bind.annotation.ResponseBody
|
||||
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
|
||||
import javax.servlet.RequestDispatcher
|
||||
import javax.servlet.http.HttpServletRequest
|
||||
|
||||
@ControllerAdvice(basePackageClasses = [SomeController::class])
|
||||
class MyControllerAdvice : ResponseEntityExceptionHandler() {
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
|
||||
package org.springframework.boot.docs.web.servlet.springmvc.errorhandling.errorpages
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest
|
||||
import org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver
|
||||
import org.springframework.http.HttpStatus
|
||||
import org.springframework.web.servlet.ModelAndView
|
||||
import javax.servlet.http.HttpServletRequest
|
||||
|
||||
class MyErrorViewResolver : ErrorViewResolver {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
|
||||
package org.springframework.boot.docs.web.servlet.springmvc.errorhandling.errorpageswithoutspringmvc
|
||||
|
||||
import jakarta.servlet.FilterChain
|
||||
import jakarta.servlet.ServletRequest
|
||||
import jakarta.servlet.ServletResponse
|
||||
import org.springframework.web.filter.GenericFilterBean
|
||||
import javax.servlet.FilterChain
|
||||
import javax.servlet.ServletRequest
|
||||
import javax.servlet.ServletResponse
|
||||
|
||||
class MyFilter : GenericFilterBean() {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
package org.springframework.boot.docs.web.servlet.springmvc.errorhandling.errorpageswithoutspringmvc
|
||||
|
||||
import jakarta.servlet.DispatcherType
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import java.util.EnumSet
|
||||
import javax.servlet.DispatcherType
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class MyFilterConfiguration {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import com.fasterxml.jackson.databind.JsonSerializer
|
|||
import com.fasterxml.jackson.databind.SerializerProvider
|
||||
import org.springframework.boot.jackson.JsonComponent
|
||||
import java.io.IOException
|
||||
import kotlin.jvm.Throws
|
||||
|
||||
@JsonComponent
|
||||
class MyJsonComponent {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import org.springframework.boot.jackson.JsonComponent
|
|||
import org.springframework.boot.jackson.JsonObjectDeserializer
|
||||
import org.springframework.boot.jackson.JsonObjectSerializer
|
||||
import java.io.IOException
|
||||
import kotlin.jvm.Throws
|
||||
|
||||
@JsonComponent
|
||||
class MyJsonComponent {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import org.springframework.http.converter.AbstractHttpMessageConverter
|
|||
import org.springframework.http.converter.HttpMessageNotReadableException
|
||||
import org.springframework.http.converter.HttpMessageNotWritableException
|
||||
import java.io.IOException
|
||||
import kotlin.jvm.Throws
|
||||
|
||||
open class AdditionalHttpMessageConverter : AbstractHttpMessageConverter<Any?>() {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue