Spring Security无法加载资源:服务器响应的状态为404
问题描述:
当我导航到认证的URL时,所有静态内容甚至URL里面的href都已附加到路由的url中,因为我得到了404在该页面中的所有资源和HREF元素Spring Security无法加载资源:服务器响应的状态为404
里面所有的URL为前
<security:http auto-config="true" use-expressions="false">
<security:intercept-url pattern="/reports/**" access="ROLE_USER"/>
<security:intercept-url pattern="/**" access="ROLE_ANONYMOUS"/>
<security:form-login login-page="/login.do" login-processing-url="/login.do" username-parameter="custom_username"
password-parameter="custom_password"
authentication-success-handler-ref="authSuccessHandler"
default-target-url="/"
always-use-default-target="true"
authentication-failure-url="/login.do?error=true"/>
<security:logout logout-url="/logout.do" logout-success-url="/login.do?logout=true"/>
<security:csrf disabled="true"/>
</security:http >
<security:authentication-manager>
<security:authentication-provider>
<security:user-service>
<security:user name="user1" password="password" authorities="ROLE_USER"/>
<security:user name="admin" password="password" authorities="ROLE_USER,ROLE_FOO"/>
</security:user-service>
</security:authentication-provider>
</security:authentication-manager>
<security:http pattern="**/styles/**" security="none" />
<security:http pattern="**/js/**" security="none" />
,当我浏览到的myapp /报告/我的静态内容已被更改为
通常在HTML,它看起来像
<link href="styles/jqueryUI.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="styles/Home.css">
<link rel="stylesheet" href="styles/metisMenu.min.css">
<link rel="stylesheet" href="styles/sideBar.css">
东西,我在这里错过了连我都enebled MVC:资源
<mvc:annotation-driven/>
<mvc:resources mapping="/WebContent/styles/**" location="css/" />
<mvc:resources mapping="/WebContent/js/**" location="js/" />
<mvc:resources mapping="/WebContent/images/**" location="images/" />
<mvc:resources mapping="/WebContent/fonts/**" location="fonts/" />
你的问题不明确? –