Commit 322b0377 authored by Dave Syer's avatar Dave Syer

Upgrade Thymeleaf and Spring

parent f39b044c
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
package org.springframework.boot.autoconfigure.thymeleaf; package org.springframework.boot.autoconfigure.thymeleaf;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
...@@ -39,11 +37,10 @@ import org.springframework.core.Ordered; ...@@ -39,11 +37,10 @@ import org.springframework.core.Ordered;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.ResourceLoader;
import org.thymeleaf.TemplateProcessingParameters;
import org.thymeleaf.dialect.IDialect; import org.thymeleaf.dialect.IDialect;
import org.thymeleaf.extras.springsecurity3.dialect.SpringSecurityDialect; import org.thymeleaf.extras.springsecurity3.dialect.SpringSecurityDialect;
import org.thymeleaf.resourceresolver.IResourceResolver;
import org.thymeleaf.spring3.SpringTemplateEngine; import org.thymeleaf.spring3.SpringTemplateEngine;
import org.thymeleaf.spring3.resourceresolver.SpringResourceResourceResolver;
import org.thymeleaf.spring3.view.ThymeleafViewResolver; import org.thymeleaf.spring3.view.ThymeleafViewResolver;
import org.thymeleaf.templateresolver.ITemplateResolver; import org.thymeleaf.templateresolver.ITemplateResolver;
import org.thymeleaf.templateresolver.TemplateResolver; import org.thymeleaf.templateresolver.TemplateResolver;
...@@ -79,25 +76,7 @@ public class ThymeleafAutoConfiguration { ...@@ -79,25 +76,7 @@ public class ThymeleafAutoConfiguration {
@Bean @Bean
public ITemplateResolver defaultTemplateResolver() { public ITemplateResolver defaultTemplateResolver() {
TemplateResolver resolver = new TemplateResolver(); TemplateResolver resolver = new TemplateResolver();
resolver.setResourceResolver(new IResourceResolver() { resolver.setResourceResolver(thymeleafResourceResolver());
@Override
public InputStream getResourceAsStream(
TemplateProcessingParameters templateProcessingParameters,
String resourceName) {
try {
return DefaultTemplateResolverConfiguration.this.resourceLoader
.getResource(resourceName).getInputStream();
}
catch (IOException ex) {
return null;
}
}
@Override
public String getName() {
return "SPRING";
}
});
resolver.setPrefix(this.environment.getProperty("prefix", DEFAULT_PREFIX)); resolver.setPrefix(this.environment.getProperty("prefix", DEFAULT_PREFIX));
resolver.setSuffix(this.environment.getProperty("suffix", DEFAULT_SUFFIX)); resolver.setSuffix(this.environment.getProperty("suffix", DEFAULT_SUFFIX));
resolver.setTemplateMode(this.environment.getProperty("mode", "HTML5")); resolver.setTemplateMode(this.environment.getProperty("mode", "HTML5"));
...@@ -108,6 +87,11 @@ public class ThymeleafAutoConfiguration { ...@@ -108,6 +87,11 @@ public class ThymeleafAutoConfiguration {
return resolver; return resolver;
} }
@Bean
protected SpringResourceResourceResolver thymeleafResourceResolver() {
return new SpringResourceResourceResolver();
}
public static boolean templateExists(Environment environment, public static boolean templateExists(Environment environment,
ResourceLoader resourceLoader, String view) { ResourceLoader resourceLoader, String view) {
String prefix = environment.getProperty("spring.thymeleaf.prefix", String prefix = environment.getProperty("spring.thymeleaf.prefix",
......
...@@ -39,17 +39,18 @@ import org.springframework.context.annotation.Bean; ...@@ -39,17 +39,18 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.config.EnableWebSocket; import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.server.config.WebSocketConfigurer; import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.server.config.WebSocketHandlerRegistry; import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.sockjs.transport.handler.DefaultSockJsService; import org.springframework.web.socket.sockjs.transport.handler.DefaultSockJsService;
/** /**
* Auto configuration for websockets (and sockjs in particular). Users should be able to * Auto configuration for websocket server (and sockjs in particular). Users should be
* just define beans of type {@link WebSocketHandler}. If <code>spring-websocket</code> is * able to just define beans of type {@link WebSocketHandler}. If
* detected on the classpath then we add a {@link DefaultSockJsService} and an MVC handler * <code>spring-websocket</code> is detected on the classpath then we add a
* mapping to <code>/&lt;beanName&gt;/**</code> for all of the * {@link DefaultSockJsService} and an MVC handler mapping to
* <code>WebSocketHandler</code> beans that have a bean name beginning with "/". * <code>/&lt;beanName&gt;/**</code> for all of the <code>WebSocketHandler</code> beans
* that have a bean name beginning with "/".
* *
* @author Dave Syer * @author Dave Syer
*/ */
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<snakeyaml.version>1.12</snakeyaml.version> <snakeyaml.version>1.12</snakeyaml.version>
<spock.version>0.7-groovy-2.0</spock.version> <spock.version>0.7-groovy-2.0</spock.version>
<spring.version>4.0.0.BUILD-SNAPSHOT</spring.version> <spring.version>4.0.0.BUILD-SNAPSHOT</spring.version>
<spring-integration.version>2.2.4.RELEASE</spring-integration.version> <spring-integration.version>2.2.6.RELEASE</spring-integration.version>
<spring-integration-groovydsl.version>1.0.0.M1</spring-integration-groovydsl.version> <spring-integration-groovydsl.version>1.0.0.M1</spring-integration-groovydsl.version>
<spring-batch.version>2.2.2.RELEASE</spring-batch.version> <spring-batch.version>2.2.2.RELEASE</spring-batch.version>
<spring-data-jpa.version>1.4.2.RELEASE</spring-data-jpa.version> <spring-data-jpa.version>1.4.2.RELEASE</spring-data-jpa.version>
...@@ -46,9 +46,9 @@ ...@@ -46,9 +46,9 @@
<spring-rabbit.version>1.2.0.RELEASE</spring-rabbit.version> <spring-rabbit.version>1.2.0.RELEASE</spring-rabbit.version>
<spring-mobile.version>1.1.0.RELEASE</spring-mobile.version> <spring-mobile.version>1.1.0.RELEASE</spring-mobile.version>
<spring-security.version>3.2.0.RC2</spring-security.version> <spring-security.version>3.2.0.RC2</spring-security.version>
<thymeleaf.version>2.0.19</thymeleaf.version> <thymeleaf.version>2.1.1.RELEASE</thymeleaf.version>
<thymeleaf-extras-springsecurity3.version>2.0.1</thymeleaf-extras-springsecurity3.version> <thymeleaf-extras-springsecurity3.version>2.1.0.RELEASE</thymeleaf-extras-springsecurity3.version>
<thymeleaf-layout-dialect.version>1.1.3</thymeleaf-layout-dialect.version> <thymeleaf-layout-dialect.version>1.2</thymeleaf-layout-dialect.version>
<tomcat.version>7.0.47</tomcat.version> <tomcat.version>7.0.47</tomcat.version>
<crashub.version>1.3.0-beta11</crashub.version> <crashub.version>1.3.0-beta11</crashub.version>
<jolokia.version>1.1.5</jolokia.version> <jolokia.version>1.1.5</jolokia.version>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment