然而,安全性已经启用并阻止访问主网页。我已经检查了几份文档,包括: 从spring-security.xml文件禁用Spring Security 在使用Spring Security Java配置时禁用基本身份验证
http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-security.html
http://docs.spring.io/spring-boot/docs/current/reference/html/howto-security.html
找不到可行的答案。
我做了以下步骤:
将index.html添加到web.xml中的<welcome-file-list>。这将使我进入登录页面,该页面已经包含在我接手的程序包中。所以,我想我可以简单地禁用安全性。
在spring security.xml中添加了属性security="none"。现在我不再得到登录页面,而是得到一个空白页面。
在web.xml中禁用
<!-- <filter> -->
<!-- <filter-name>springSecurityFilterChain</filter-name> -->
<!-- <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> -->
<!-- </filter> -->
<!-- <filter-mapping> -->
<!-- <filter-name>springSecurityFilterChain</filter-name> -->
<!-- <url-pattern>/*</url-pattern> -->
<!-- </filter-mapping> -->
仍然得到空白页面。
我看到很多其他建议,但它们假定我拥有比我当前拥有的更多的Spring知识。
例如,在上面第4个链接中,我看到:
如果您在应用程序的任何位置定义了带有@EnableWebSecurity的@Configuration,则会关闭Spring Boot中默认的Web应用程序安全设置。
我不知道他们的意思。我认为这意味着将这些注释放在某个方法上,但我无法相信这可以放在应用程序中任何Java类的任何地方。有没有做到这一点的示例?
有人能指点我正确的方向吗?谢谢。