小编Ben*_*ler的帖子

Spring Boot Starter Cache - 缺少Velocity?

我正在使用ehcache测试Spring Boot 1.3.0.M3并遇到一些问题.

当我启动应用程序后,控制台上发生异常:

线程"main"中的异常org.springframework.beans.factory.BeanCreationException:在类路径资源中定义名为'velocityConfigurer'的bean时出错[org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration $ VelocityWebConfiguration.class]:init的调用方法失败; 嵌套异常是org.springframework.beans.factory中的org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)中的java.lang.NoClassDefFoundError:org/apache/velocity/runtime/log/CommonsLogLogChute.在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory上的support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545).

我的pom.xml:

...
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.0.M3</version>
</parent>
...
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-cache</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>net.sf.ehcache</groupId>
        <artifactId>ehcache</artifactId>
    </dependency>
    ...
</dependencies>
...
Run Code Online (Sandbox Code Playgroud)

mvn依赖:树

org.springframework.boot:spring-boot-starter-web:jar:1.3.0.M3:compile [INFO] | + - org.springframework.boot:spring-boot-starter:jar:1.3.0.M3:compile [INFO] | | + - org.springframework.boot:spring-boot:jar:1.3.0.M3:compile [INFO] | | + - org.springframework.boot:spring-boot-autoconfigure:jar:1.3.0.M3:compile [INFO] | | - org.yaml:snakeyaml:jar:1.15:编译[INFO] | + - org.springframework.boot:spring-boot-starter-validation:jar:1.3.0.M3:compile [INFO] | | - org.hibernate:hibernate-validator:jar:5.2.1.Final:compile [INFO] | | + - javax.validation:validation-api:jar:1.1.0.Final:compile [INFO] | | - com.fasterxml:classmate:jar:1.1.0:compile …

java spring maven

4
推荐指数
1
解决办法
6215
查看次数

Thymeleaf:<label>将动态文本与静态文本Spring MVC连接起来

我正在尝试将一些文本附加到动态文本中,如下所示:

<label th:text="Hello ${worldText}"></label>
Run Code Online (Sandbox Code Playgroud)

但UI抛出:

TemplateProcessingException: Could not parse as expression: "Hello ${worldText}

有谁知道我怎么能做到这一点?

append spring-mvc dynamic-text thymeleaf spring-boot

3
推荐指数
1
解决办法
7914
查看次数

Spring Boot-在登录页面上更改语言环境

我有一个带有简单表单登录的Spring Boot应用程序。登录正常。

http
    .authorizeRequests()
        .anyRequest().authenticated()
        .and()
    .formLogin()
        .loginPage("/login")
        .permitAll()
        .and()
    .logout()
        .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
        .logoutSuccessUrl("/login")
        .permitAll();
Run Code Online (Sandbox Code Playgroud)

我还通过CookieLocaleResolver和LocaleChangeInterceptor进行了国际化。登录后也可以使用。

我的问题是:

用户在登录页面上时无法更改语言环境。

登录页面:https:// localhost / login

链接以更改语言环境:https:// localhost / login?locale = en

但是用户再次被重定向到https:// localhost / login,区域设置保持不变。

有没有办法在登录页面上允许参数?

谢谢你的帮助!

spring spring-security spring-boot

2
推荐指数
1
解决办法
921
查看次数