diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTemplate.java b/spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTemplate.java
index 0b2eb742197..6cc98621022 100644
--- a/spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTemplate.java
+++ b/spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTemplate.java
@@ -1176,7 +1176,6 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean
}
}
-
@Deprecated
@SuppressWarnings({"rawtypes", "deprecation"})
private static org.hibernate.Query queryObject(@Nullable Object result) {
@@ -1228,12 +1227,12 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean
// If return value is a Query or Criteria, apply transaction timeout.
// Applies to createQuery, getNamedQuery, createCriteria.
- if (retVal instanceof org.hibernate.Query) {
- prepareQuery(((org.hibernate.Query) retVal));
- }
- else if (retVal instanceof Criteria) {
+ if (retVal instanceof Criteria) {
prepareCriteria(((Criteria) retVal));
}
+ else if (retVal instanceof org.hibernate.Query) {
+ prepareQuery(((org.hibernate.Query) retVal));
+ }
return retVal;
}
diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointRegistration.java b/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointRegistration.java
index fbc2bf7f50f..6da51901b4d 100644
--- a/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointRegistration.java
+++ b/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointRegistration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2018 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.
@@ -36,7 +36,7 @@ import org.springframework.web.socket.handler.BeanCreatingHandlerProvider;
/**
* An implementation of {@link javax.websocket.server.ServerEndpointConfig} for use in
- * Spring applications. A {@link ServerEndpointRegistration} bean is detected by
+ * Spring-based applications. A {@link ServerEndpointRegistration} bean is detected by
* {@link ServerEndpointExporter} and registered with a Java WebSocket runtime at startup.
*
*
Class constructors accept a singleton {@link javax.websocket.Endpoint} instance
@@ -45,11 +45,12 @@ import org.springframework.web.socket.handler.BeanCreatingHandlerProvider;
* each client WebSocket connection.
*
*
This class also extends
- * {@link javax.websocket.server.ServerEndpointConfig.Configurator} to make it easier to
- * override methods for customizing the handshake process.
+ * {@link javax.websocket.server.ServerEndpointConfig.Configurator} to make it easier
+ * to override methods for customizing the handshake process.
*
* @author Rossen Stoyanchev
- * @since 5.0
+ * @author Juergen Hoeller
+ * @since 4.0
* @see ServerEndpointExporter
*/
public class ServerEndpointRegistration extends ServerEndpointConfig.Configurator
@@ -63,15 +64,15 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato
@Nullable
private final BeanCreatingHandlerProvider endpointProvider;
- private List> encoders = new ArrayList<>();
+ private List subprotocols = new ArrayList<>(0);
- private List> decoders = new ArrayList<>();
+ private List extensions = new ArrayList<>(0);
- private List protocols = new ArrayList<>();
+ private List> encoders = new ArrayList<>(0);
- private List extensions = new ArrayList<>();
+ private List> decoders = new ArrayList<>(0);
- private final Map userProperties = new HashMap<>();
+ private final Map userProperties = new HashMap<>(4);
/**
@@ -81,8 +82,8 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato
* @param endpoint the endpoint instance
*/
public ServerEndpointRegistration(String path, Endpoint endpoint) {
- Assert.hasText(path, "path must not be empty");
- Assert.notNull(endpoint, "endpoint must not be null");
+ Assert.hasText(path, "Path must not be empty");
+ Assert.notNull(endpoint, "Endpoint must not be null");
this.path = path;
this.endpoint = endpoint;
this.endpointProvider = null;
@@ -95,14 +96,16 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato
* @param endpointClass the endpoint class
*/
public ServerEndpointRegistration(String path, Class extends Endpoint> endpointClass) {
- Assert.hasText(path, "path must not be empty");
- Assert.notNull(endpointClass, "endpointClass must not be null");
+ Assert.hasText(path, "Path must not be empty");
+ Assert.notNull(endpointClass, "Endpoint Class must not be null");
this.path = path;
this.endpoint = null;
this.endpointProvider = new BeanCreatingHandlerProvider<>(endpointClass);
}
+ // ServerEndpointConfig implementation
+
@Override
public String getPath() {
return this.path;
@@ -129,13 +132,13 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato
}
}
- public void setSubprotocols(List protocols) {
- this.protocols = protocols;
+ public void setSubprotocols(List subprotocols) {
+ this.subprotocols = subprotocols;
}
@Override
public List getSubprotocols() {
- return this.protocols;
+ return this.subprotocols;
}
public void setExtensions(List extensions) {
@@ -147,16 +150,6 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato
return this.extensions;
}
- public void setUserProperties(Map userProperties) {
- this.userProperties.clear();
- this.userProperties.putAll(userProperties);
- }
-
- @Override
- public Map getUserProperties() {
- return this.userProperties;
- }
-
public void setEncoders(List> encoders) {
this.encoders = encoders;
}
@@ -175,20 +168,23 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato
return this.decoders;
}
+ public void setUserProperties(Map userProperties) {
+ this.userProperties.clear();
+ this.userProperties.putAll(userProperties);
+ }
+
@Override
- public Configurator getConfigurator() {
- return this;
+ public Map getUserProperties() {
+ return this.userProperties;
}
@Override
- public void setBeanFactory(BeanFactory beanFactory) {
- if (this.endpointProvider != null) {
- this.endpointProvider.setBeanFactory(beanFactory);
- }
+ public Configurator getConfigurator() {
+ return this;
}
- // Implementations of ServerEndpointConfig.Configurator
+ // ServerEndpointConfig.Configurator implementation
@SuppressWarnings("unchecked")
@Override
@@ -201,8 +197,19 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato
super.modifyHandshake(this, request, response);
}
+
+ // Remaining methods
+
+ @Override
+ public void setBeanFactory(BeanFactory beanFactory) {
+ if (this.endpointProvider != null) {
+ this.endpointProvider.setBeanFactory(beanFactory);
+ }
+ }
+
@Override
public String toString() {
return "ServerEndpointRegistration for path '" + getPath() + "': " + getEndpointClass();
}
+
}