小编Fre*_*mmi的帖子

即使在指定`create-session ="无状态"之后,`spring也在创建JSESSIONID cookie

即使在指定create-session="stateless"spring 之后创建了JSESSIONID cookie并将其写入浏览器缓存.我的理解是; 如果我们提到它作为无状态弹簧不会添加任何东西到会话.我在这里遗漏了什么或者我的理解错了吗?

我面临的问题是

我在我的应用程序中使用基本身份验证(用于休息服务)和基于表单的身份验证.如果用户登录到firefox,并且他使用基本身份验证使用RestClient调用其余服务,则会在返回其余服务后注销第一个用户.我的目的是让第一个用户会话保持活动状态.请在下面找到我的配置

<http auto-config="false" pattern="/rest/internal/**"
    entry-point-ref="headerBasedAuthenticationEntryPoint" create-session="stateless"
    disable-url-rewriting="true">

    <custom-filter position="BASIC_AUTH_FILTER"
        ref="headerBasedAuthenticationFilter" />
</http>
Run Code Online (Sandbox Code Playgroud)

我在RestCLient中获得以下响应头

Status Code: 200 OK
Content-Language: null
Content-Length: 1043
Content-Type: text/html;charset=utf-8
Date: Wed, 19 Nov 2014 10:26:57 GMT
Set-Cookie: JSESSIONID=77C3AC743413C9455CF6FB1EC35F021E; Path=/myApplication/; HttpOnly login=""; Path=/; Secure; HttpOnly userId=4be114d57a3c4d428e3ec9b3cea33463; Expires=Sat, 28-Jul-2046 12:13:37 GMT; Path=/; Secure; HttpOnly lang=en; Expires=Sat, 28-Jul-2046 12:13:37 GMT; Path=/
Run Code Online (Sandbox Code Playgroud)

spring spring-security

6
推荐指数
0
解决办法
1719
查看次数

Spring社交示例不起作用

我在尝试访问spring-social示例时遇到以下错误.有人可以指导我.

 org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template "signin", template might not exist or might not be accessible by any of the configured Template Resolver
Run Code Online (Sandbox Code Playgroud)

spring-security spring-social

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

Spring Junit 不工作

我正在尝试为我的带注释的类编写单元测试。当我取消时,我得到以下异常

java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @BootstrapWith's 'value' attribute or make the default bootstrapper class available.
    at org.springframework.test.context.BootstrapUtils.resolveTestContextBootstrapper(BootstrapUtils.java:143)
    at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:105)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTestContextManager(SpringJUnit4ClassRunner.java:152)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(SpringJUnit4ClassRunner.java:143)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:84)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.findAllMergedAnnotations(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/Class;)Ljava/util/Set;
    at org.springframework.test.context.BootstrapUtils.resolveExplicitTestContextBootstrapper(BootstrapUtils.java:150)
    at org.springframework.test.context.BootstrapUtils.resolveTestContextBootstrapper(BootstrapUtils.java:126)
    ... 20 more
Run Code Online (Sandbox Code Playgroud)

下面是我的 pom.xml。我尝试使用 4.3.4 和 4.3.5 作为 spring 版本 …

java junit spring spring-test junit4

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