Polish
This commit is contained in:
parent
afda0ec129
commit
7fc12bc8a3
|
@ -116,7 +116,7 @@ class CloudFoundrySecurityService {
|
|||
}
|
||||
|
||||
private Map<String, String> extractTokenKeys(Map<?, ?> response) {
|
||||
Map<String, String> tokenKeys = new HashMap<String, String>();
|
||||
Map<String, String> tokenKeys = new HashMap<>();
|
||||
for (Object key : (List<?>) response.get("keys")) {
|
||||
Map<?, ?> tokenKey = (Map<?, ?>) key;
|
||||
tokenKeys.put((String) tokenKey.get("kid"), (String) tokenKey.get("value"));
|
||||
|
|
|
@ -101,7 +101,7 @@ class CloudFoundryWebEndpointServletHandlerMapping
|
|||
return Collections.singletonMap("_links", filteredLinks);
|
||||
}
|
||||
filteredLinks = links.entrySet().stream()
|
||||
.filter(e -> e.getKey().equals("self")
|
||||
.filter((e) -> e.getKey().equals("self")
|
||||
|| accessLevel.isAccessAllowed(e.getKey()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
return Collections.singletonMap("_links", filteredLinks);
|
||||
|
|
|
@ -52,8 +52,8 @@ public class Neo4jHealthIndicator extends AbstractHealthIndicator {
|
|||
protected void doHealthCheck(Health.Builder builder) throws Exception {
|
||||
Session session = this.sessionFactory.openSession();
|
||||
Result result = session.query(CYPHER, Collections.emptyMap());
|
||||
builder.up().withDetail("nodes", result.queryResults()
|
||||
.iterator().next().get("nodes"));
|
||||
builder.up().withDetail("nodes",
|
||||
result.queryResults().iterator().next().get("nodes"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class WebMvcEndpointInfrastructureAutoConfigurationTests {
|
|||
|
||||
@Test
|
||||
public void webEndpointsAreDisabledByDefault() {
|
||||
this.contextRunner.run(context -> {
|
||||
this.contextRunner.run((context) -> {
|
||||
MockMvc mvc = MockMvcBuilders.webAppContextSetup(context).build();
|
||||
assertThat(isExposed(mvc, HttpMethod.GET, "autoconfig")).isFalse();
|
||||
assertThat(isExposed(mvc, HttpMethod.GET, "beans")).isFalse();
|
||||
|
@ -76,7 +76,7 @@ public class WebMvcEndpointInfrastructureAutoConfigurationTests {
|
|||
public void webEndpointsCanBeEnabled() {
|
||||
WebApplicationContextRunner contextRunner = this.contextRunner
|
||||
.withPropertyValues("endpoints.default.web.enabled=true");
|
||||
contextRunner.run(context -> {
|
||||
contextRunner.run((context) -> {
|
||||
MockMvc mvc = MockMvcBuilders.webAppContextSetup(context).build();
|
||||
assertThat(isExposed(mvc, HttpMethod.GET, "autoconfig")).isTrue();
|
||||
assertThat(isExposed(mvc, HttpMethod.GET, "beans")).isTrue();
|
||||
|
|
|
@ -69,22 +69,22 @@ public class CloudFoundryMvcWebEndpointIntegrationTests {
|
|||
public void operationWithSecurityInterceptorForbidden() throws Exception {
|
||||
given(securityService.getAccessLevel(any(), eq("app-id")))
|
||||
.willReturn(AccessLevel.RESTRICTED);
|
||||
load(TestEndpointConfiguration.class, (client) -> {
|
||||
client.get().uri("/cfApplication/test").accept(MediaType.APPLICATION_JSON)
|
||||
.header("Authorization", "bearer " + mockAccessToken()).exchange()
|
||||
.expectStatus().isEqualTo(HttpStatus.FORBIDDEN);
|
||||
});
|
||||
load(TestEndpointConfiguration.class,
|
||||
(client) -> client.get().uri("/cfApplication/test")
|
||||
.accept(MediaType.APPLICATION_JSON)
|
||||
.header("Authorization", "bearer " + mockAccessToken()).exchange()
|
||||
.expectStatus().isEqualTo(HttpStatus.FORBIDDEN));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operationWithSecurityInterceptorSuccess() throws Exception {
|
||||
given(securityService.getAccessLevel(any(), eq("app-id")))
|
||||
.willReturn(AccessLevel.FULL);
|
||||
load(TestEndpointConfiguration.class, (client) -> {
|
||||
client.get().uri("/cfApplication/test").accept(MediaType.APPLICATION_JSON)
|
||||
.header("Authorization", "bearer " + mockAccessToken()).exchange()
|
||||
.expectStatus().isEqualTo(HttpStatus.OK);
|
||||
});
|
||||
load(TestEndpointConfiguration.class,
|
||||
(client) -> client.get().uri("/cfApplication/test")
|
||||
.accept(MediaType.APPLICATION_JSON)
|
||||
.header("Authorization", "bearer " + mockAccessToken()).exchange()
|
||||
.expectStatus().isEqualTo(HttpStatus.OK));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -135,9 +135,8 @@ public class RequestMappingEndpointTests {
|
|||
OperationRequestPredicate requestPredicate = new OperationRequestPredicate("test",
|
||||
WebEndpointHttpMethod.GET, Collections.singletonList("application/json"),
|
||||
Collections.singletonList("application/json"));
|
||||
WebEndpointOperation operation = new WebEndpointOperation(
|
||||
OperationType.READ, (arguments) -> "Invoked", true,
|
||||
requestPredicate, "test");
|
||||
WebEndpointOperation operation = new WebEndpointOperation(OperationType.READ,
|
||||
(arguments) -> "Invoked", true, requestPredicate, "test");
|
||||
WebEndpointServletHandlerMapping mapping = new WebEndpointServletHandlerMapping(
|
||||
"application", Collections.singleton(new EndpointInfo<>("test", true,
|
||||
Collections.singleton(operation))));
|
||||
|
|
|
@ -46,7 +46,8 @@ import org.springframework.http.converter.support.AllEncompassingFormHttpMessage
|
|||
public class BackgroundPreinitializer
|
||||
implements ApplicationListener<SpringApplicationEvent> {
|
||||
|
||||
private static final AtomicBoolean preinitializationStarted = new AtomicBoolean(false);
|
||||
private static final AtomicBoolean preinitializationStarted = new AtomicBoolean(
|
||||
false);
|
||||
|
||||
private static final CountDownLatch preinitializationComplete = new CountDownLatch(1);
|
||||
|
||||
|
|
|
@ -40,7 +40,8 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
|||
* @see EnableAspectJAutoProxy
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass({ EnableAspectJAutoProxy.class, Aspect.class, Advice.class, AnnotatedElement.class })
|
||||
@ConditionalOnClass({ EnableAspectJAutoProxy.class, Aspect.class, Advice.class,
|
||||
AnnotatedElement.class })
|
||||
@ConditionalOnProperty(prefix = "spring.aop", name = "auto", havingValue = "true", matchIfMissing = true)
|
||||
public class AopAutoConfiguration {
|
||||
|
||||
|
|
|
@ -92,8 +92,8 @@ class DataSourceInitializedPublisher implements BeanPostProcessor {
|
|||
}
|
||||
String defaultDdlAuto = (EmbeddedDatabaseConnection.isEmbedded(dataSource)
|
||||
? "create-drop" : "none");
|
||||
Map<String, String> hibernate = this.properties.getHibernateProperties(
|
||||
defaultDdlAuto);
|
||||
Map<String, String> hibernate = this.properties
|
||||
.getHibernateProperties(defaultDdlAuto);
|
||||
if (hibernate.containsKey("hibernate.hbm2ddl.auto")) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -109,8 +109,8 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration {
|
|||
@Override
|
||||
protected Map<String, Object> getVendorProperties() {
|
||||
Map<String, Object> vendorProperties = new LinkedHashMap<>();
|
||||
String defaultDdlMode = this.defaultDdlAutoProvider.getDefaultDdlAuto(
|
||||
getDataSource());
|
||||
String defaultDdlMode = this.defaultDdlAutoProvider
|
||||
.getDefaultDdlAuto(getDataSource());
|
||||
vendorProperties.putAll(getProperties().getHibernateProperties(defaultDdlMode));
|
||||
return vendorProperties;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.springframework.boot.autoconfigure.security;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -79,10 +78,8 @@ public class AuthenticationManagerConfiguration {
|
|||
}
|
||||
|
||||
@Bean
|
||||
public static SpringBootAuthenticationConfigurerAdapter springBootAuthenticationConfigurerAdapter(
|
||||
SecurityProperties securityProperties,
|
||||
List<SecurityPrerequisite> dependencies) {
|
||||
return new SpringBootAuthenticationConfigurerAdapter(securityProperties);
|
||||
public static SpringBootAuthenticationConfigurerAdapter springBootAuthenticationConfigurerAdapter() {
|
||||
return new SpringBootAuthenticationConfigurerAdapter();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -118,16 +115,9 @@ public class AuthenticationManagerConfiguration {
|
|||
private static class SpringBootAuthenticationConfigurerAdapter
|
||||
extends GlobalAuthenticationConfigurerAdapter {
|
||||
|
||||
private final SecurityProperties securityProperties;
|
||||
|
||||
SpringBootAuthenticationConfigurerAdapter(SecurityProperties securityProperties) {
|
||||
this.securityProperties = securityProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.apply(new DefaultInMemoryUserDetailsManagerConfigurer(
|
||||
this.securityProperties));
|
||||
auth.apply(new DefaultInMemoryUserDetailsManagerConfigurer());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -156,13 +146,6 @@ public class AuthenticationManagerConfiguration {
|
|||
private static class DefaultInMemoryUserDetailsManagerConfigurer
|
||||
extends InMemoryUserDetailsManagerConfigurer<AuthenticationManagerBuilder> {
|
||||
|
||||
private final SecurityProperties securityProperties;
|
||||
|
||||
DefaultInMemoryUserDetailsManagerConfigurer(
|
||||
SecurityProperties securityProperties) {
|
||||
this.securityProperties = securityProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
if (auth.isConfigured()) {
|
||||
|
|
|
@ -81,7 +81,7 @@ public final class SpringBootSecurity {
|
|||
*/
|
||||
public RequestMatcher endpoints(Class<?>... endpoints) {
|
||||
Assert.notEmpty(endpoints, "At least one endpoint must be specified.");
|
||||
List<String> paths = Arrays.stream(endpoints).map(e -> {
|
||||
List<String> paths = Arrays.stream(endpoints).map((e) -> {
|
||||
if (e.isAnnotationPresent(Endpoint.class)) {
|
||||
return e.getAnnotation(Endpoint.class).id();
|
||||
}
|
||||
|
|
|
@ -40,12 +40,8 @@ public class OAuth2SsoDefaultConfiguration extends WebSecurityConfigurerAdapter
|
|||
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
private final OAuth2SsoProperties sso;
|
||||
|
||||
public OAuth2SsoDefaultConfiguration(ApplicationContext applicationContext,
|
||||
OAuth2SsoProperties sso) {
|
||||
public OAuth2SsoDefaultConfiguration(ApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
this.sso = sso;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -120,12 +120,14 @@ public class FlywayAutoConfigurationTests {
|
|||
registerAndRefresh(FlywayDataSourceConfiguration.class,
|
||||
EmbeddedDataSourceConfiguration.class, FlywayAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
FlywaySchemaManagementProvider schemaManagementProvider = this.context.getBean(
|
||||
FlywaySchemaManagementProvider.class);
|
||||
assertThat(schemaManagementProvider.getSchemaManagement(this.context.getBean(
|
||||
DataSource.class))).isEqualTo(SchemaManagement.UNMANAGED);
|
||||
assertThat(schemaManagementProvider.getSchemaManagement(this.context.getBean(
|
||||
"flywayDataSource", DataSource.class))).isEqualTo(SchemaManagement.MANAGED);
|
||||
FlywaySchemaManagementProvider schemaManagementProvider = this.context
|
||||
.getBean(FlywaySchemaManagementProvider.class);
|
||||
assertThat(schemaManagementProvider
|
||||
.getSchemaManagement(this.context.getBean(DataSource.class)))
|
||||
.isEqualTo(SchemaManagement.UNMANAGED);
|
||||
assertThat(schemaManagementProvider.getSchemaManagement(
|
||||
this.context.getBean("flywayDataSource", DataSource.class)))
|
||||
.isEqualTo(SchemaManagement.MANAGED);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -61,15 +61,16 @@ public class H2ConsoleAutoConfigurationIntegrationTests {
|
|||
public void noPrincipal() throws Exception {
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
|
||||
.apply(springSecurity()).build();
|
||||
mockMvc.perform(get("/h2-console/").accept(MediaType.APPLICATION_JSON)).andExpect(status().isUnauthorized());
|
||||
mockMvc.perform(get("/h2-console/").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isUnauthorized());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void userPrincipal() throws Exception {
|
||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
|
||||
.apply(springSecurity()).build();
|
||||
mockMvc.perform(get("/h2-console/").accept(MediaType.APPLICATION_JSON).with(user("test").roles("USER")))
|
||||
.andExpect(status().isOk())
|
||||
mockMvc.perform(get("/h2-console/").accept(MediaType.APPLICATION_JSON)
|
||||
.with(user("test").roles("USER"))).andExpect(status().isOk())
|
||||
.andExpect(header().string("X-Frame-Options", "SAMEORIGIN"));
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,8 @@ public class CustomHibernateJpaAutoConfigurationTests {
|
|||
HibernateJpaAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
JpaProperties bean = this.context.getBean(JpaProperties.class);
|
||||
Map<String, String> hibernateProperties = bean.getHibernateProperties("create-drop");
|
||||
Map<String, String> hibernateProperties = bean
|
||||
.getHibernateProperties("create-drop");
|
||||
assertThat(hibernateProperties.get("hibernate.ejb.naming_strategy")).isNull();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,14 +53,14 @@ public class HibernateDefaultDdlAutoProviderTests {
|
|||
+ org.apache.tomcat.jdbc.pool.DataSource.class.getName(),
|
||||
"spring.datasource.database:mysql",
|
||||
"spring.datasource.url:jdbc:mysql://localhost/nonexistent",
|
||||
"spring.jpa.database:MYSQL"
|
||||
).run((context) -> {
|
||||
HibernateDefaultDdlAutoProvider ddlAutoProvider = new HibernateDefaultDdlAutoProvider(
|
||||
Collections.emptyList());
|
||||
assertThat(ddlAutoProvider.getDefaultDdlAuto(
|
||||
context.getBean(DataSource.class))).isEqualTo("none");
|
||||
"spring.jpa.database:MYSQL").run((context) -> {
|
||||
HibernateDefaultDdlAutoProvider ddlAutoProvider = new HibernateDefaultDdlAutoProvider(
|
||||
Collections.emptyList());
|
||||
assertThat(ddlAutoProvider
|
||||
.getDefaultDdlAuto(context.getBean(DataSource.class)))
|
||||
.isEqualTo("none");
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -68,8 +68,9 @@ public class HibernateDefaultDdlAutoProviderTests {
|
|||
this.contextRunner.run((context) -> {
|
||||
HibernateDefaultDdlAutoProvider ddlAutoProvider = new HibernateDefaultDdlAutoProvider(
|
||||
Collections.emptyList());
|
||||
assertThat(ddlAutoProvider.getDefaultDdlAuto(
|
||||
context.getBean(DataSource.class))).isEqualTo("create-drop");
|
||||
assertThat(
|
||||
ddlAutoProvider.getDefaultDdlAuto(context.getBean(DataSource.class)))
|
||||
.isEqualTo("create-drop");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -82,8 +83,7 @@ public class HibernateDefaultDdlAutoProviderTests {
|
|||
.willReturn(SchemaManagement.MANAGED);
|
||||
HibernateDefaultDdlAutoProvider ddlAutoProvider = new HibernateDefaultDdlAutoProvider(
|
||||
Collections.singletonList(provider));
|
||||
assertThat(ddlAutoProvider.getDefaultDdlAuto(
|
||||
dataSource)).isEqualTo("none");
|
||||
assertThat(ddlAutoProvider.getDefaultDdlAuto(dataSource)).isEqualTo("none");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -96,8 +96,8 @@ public class HibernateDefaultDdlAutoProviderTests {
|
|||
.willReturn(SchemaManagement.UNMANAGED);
|
||||
HibernateDefaultDdlAutoProvider ddlAutoProvider = new HibernateDefaultDdlAutoProvider(
|
||||
Collections.singletonList(provider));
|
||||
assertThat(ddlAutoProvider.getDefaultDdlAuto(
|
||||
dataSource)).isEqualTo("create-drop");
|
||||
assertThat(ddlAutoProvider.getDefaultDdlAuto(dataSource))
|
||||
.isEqualTo("create-drop");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -213,9 +213,8 @@ public class ConfigurationMetadata {
|
|||
public String toString() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append(String.format("items: %n"));
|
||||
this.items.values().forEach(itemMetadata -> {
|
||||
result.append("\t").append(String.format("%s%n", itemMetadata));
|
||||
});
|
||||
this.items.values().forEach((itemMetadata) -> result.append("\t")
|
||||
.append(String.format("%s%n", itemMetadata)));
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.springframework.boot.endpoint;
|
|||
* @author Madhura Bhave
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface EndpointPathResolver {
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,8 +37,8 @@ public class Operation {
|
|||
* @param operationInvoker used to perform the operation
|
||||
* @param blocking whether or not this is a blocking operation
|
||||
*/
|
||||
public Operation(OperationType type,
|
||||
OperationInvoker operationInvoker, boolean blocking) {
|
||||
public Operation(OperationType type, OperationInvoker operationInvoker,
|
||||
boolean blocking) {
|
||||
this.type = type;
|
||||
this.invoker = operationInvoker;
|
||||
this.blocking = blocking;
|
||||
|
|
|
@ -41,7 +41,7 @@ public class EndpointLinksResolver {
|
|||
Collection<EndpointInfo<WebEndpointOperation>> webEndpoints,
|
||||
String requestUrl) {
|
||||
String normalizedUrl = normalizeRequestUrl(requestUrl);
|
||||
Map<String, Link> links = new LinkedHashMap<String, Link>();
|
||||
Map<String, Link> links = new LinkedHashMap<>();
|
||||
links.put("self", new Link(normalizedUrl));
|
||||
for (EndpointInfo<WebEndpointOperation> endpoint : webEndpoints) {
|
||||
for (WebEndpointOperation operation : endpoint.getOperations()) {
|
||||
|
|
|
@ -213,16 +213,16 @@ public class WebEndpointReactiveHandlerMapping extends RequestMappingInfoHandler
|
|||
.onErrorReturn(ParameterMappingException.class,
|
||||
new ResponseEntity<>(HttpStatus.BAD_REQUEST))
|
||||
.defaultIfEmpty(
|
||||
new ResponseEntity<Object>(httpMethod == HttpMethod.GET
|
||||
new ResponseEntity<>(httpMethod == HttpMethod.GET
|
||||
? HttpStatus.NOT_FOUND : HttpStatus.NO_CONTENT));
|
||||
}
|
||||
|
||||
private ResponseEntity<Object> toResponseEntity(Object response) {
|
||||
if (!(response instanceof WebEndpointResponse)) {
|
||||
return new ResponseEntity<Object>(response, HttpStatus.OK);
|
||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||
}
|
||||
WebEndpointResponse<?> webEndpointResponse = (WebEndpointResponse<?>) response;
|
||||
return new ResponseEntity<Object>(webEndpointResponse.getBody(),
|
||||
return new ResponseEntity<>(webEndpointResponse.getBody(),
|
||||
HttpStatus.valueOf(webEndpointResponse.getStatus()));
|
||||
}
|
||||
|
||||
|
|
|
@ -123,8 +123,7 @@ public enum DatabaseDriver {
|
|||
* Firebird.
|
||||
*/
|
||||
FIREBIRD("Firebird", "org.firebirdsql.jdbc.FBDriver",
|
||||
"org.firebirdsql.ds.FBXADataSource",
|
||||
"SELECT 1 FROM RDB$DATABASE") {
|
||||
"org.firebirdsql.ds.FBXADataSource", "SELECT 1 FROM RDB$DATABASE") {
|
||||
|
||||
@Override
|
||||
protected Collection<String> getUrlPrefixes() {
|
||||
|
|
|
@ -24,6 +24,7 @@ import javax.sql.DataSource;
|
|||
* @author Stephane Nicoll
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface SchemaManagementProvider {
|
||||
|
||||
/**
|
||||
|
|
|
@ -77,8 +77,8 @@ public class SpringPhysicalNamingStrategy implements PhysicalNamingStrategy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get an identifier for the specified details. By default this method will return
|
||||
* an identifier with the name adapted based on the result of
|
||||
* Get an identifier for the specified details. By default this method will return an
|
||||
* identifier with the name adapted based on the result of
|
||||
* {@link #isCaseInsensitive(JdbcEnvironment)}
|
||||
* @param name the name of the identifier
|
||||
* @param quoted if the identifier is quoted
|
||||
|
|
|
@ -90,8 +90,8 @@ import org.springframework.util.StringUtils;
|
|||
* Can be initialized using Spring's {@link ServletContextInitializer}s or Jetty
|
||||
* {@link Configuration}s.
|
||||
* <p>
|
||||
* Unless explicitly configured otherwise this factory will create servers that listen
|
||||
* for HTTP requests on port 8080.
|
||||
* Unless explicitly configured otherwise this factory will create servers that listen for
|
||||
* HTTP requests on port 8080.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
|
@ -527,8 +527,8 @@ public class JettyServletWebServerFactory extends AbstractServletWebServerFactor
|
|||
}
|
||||
|
||||
/**
|
||||
* Post process the Jetty {@link WebAppContext} before it's used with the Jetty Server.
|
||||
* Subclasses can override this method to apply additional processing to the
|
||||
* Post process the Jetty {@link WebAppContext} before it's used with the Jetty
|
||||
* Server. Subclasses can override this method to apply additional processing to the
|
||||
* {@link WebAppContext}.
|
||||
* @param webAppContext the Jetty {@link WebAppContext}
|
||||
*/
|
||||
|
|
|
@ -89,8 +89,8 @@ import org.springframework.util.StringUtils;
|
|||
* {@link TomcatWebServer}s. Can be initialized using Spring's
|
||||
* {@link ServletContextInitializer}s or Tomcat {@link LifecycleListener}s.
|
||||
* <p>
|
||||
* Unless explicitly configured otherwise this factory will create containers that
|
||||
* listen for HTTP requests on port 8080.
|
||||
* Unless explicitly configured otherwise this factory will create containers that listen
|
||||
* for HTTP requests on port 8080.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
|
|
|
@ -563,7 +563,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
|||
|
||||
@ReadOperation
|
||||
public WebEndpointResponse<Resource> read() {
|
||||
return new WebEndpointResponse<Resource>(
|
||||
return new WebEndpointResponse<>(
|
||||
new ByteArrayResource(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }),
|
||||
200);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class JerseyWebEndpointIntegrationTests extends
|
|||
@Bean
|
||||
public ServletRegistrationBean<ServletContainer> servletContainer(
|
||||
ResourceConfig resourceConfig) {
|
||||
return new ServletRegistrationBean<ServletContainer>(
|
||||
return new ServletRegistrationBean<>(
|
||||
new ServletContainer(resourceConfig), "/*");
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class JerseyWebEndpointIntegrationTests extends
|
|||
Collection<Resource> resources = new JerseyEndpointResourceFactory()
|
||||
.createEndpointResources("endpoints",
|
||||
endpointDiscoverer.discoverEndpoints());
|
||||
resourceConfig.registerResources(new HashSet<Resource>(resources));
|
||||
resourceConfig.registerResources(new HashSet<>(resources));
|
||||
resourceConfig.register(JacksonFeature.class);
|
||||
resourceConfig.register(new ObjectMapperContextResolver(new ObjectMapper()),
|
||||
ContextResolver.class);
|
||||
|
|
Loading…
Reference in New Issue