如何从命令行(而不是从STS)运行spring security示例?

大卫·波特贝拉

我正在尝试从http://projects.spring.io/spring-security/运行示例

本指南说明了如何从Spring Tool Suite(STS)中运行insecuremvc示例:http : //docs.spring.io/spring-security/site/docs/3.2.x/guides/hellomvc.html

如何从命令行(而不是从STS)运行示例?

我尝试将以下内容添加到pom.xml-> project / build / plugins:

  <plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
      <path>/</path>
      <uriEncoding>UTF-8</uriEncoding>
      <hostName>localhost</hostName>
      <port>8080</port>
      <update>true</update>
      <useTestClasspath>true</useTestClasspath>
    </configuration>
  </plugin>

并运行

$ mvn package tomcat7:run

but browsing http://localhost:8080/sample/
I get a HTTP Status 400 - The request sent by the client was syntactically incorrect.

基于卢克答案的解决方案

$ git clone https://github.com/spring-projects/spring-security.git
$ cd spring-security/samples/insecuremvc
$ ../../gradlew tasks
# this shows several defined tasks, tomcatRunWar among them
$ ../../gradlew tomcatRunWar
小羊肖恩

我不确定这里是什么问题,但是如果您只是对运行Spring Security示例感兴趣,那么项目源代码树本身就很多。

$ git clone [email protected]:spring-projects/spring-security.git
$ cd spring-security/samples/tutorial-xml
$ ../../gradlew jettyRun

将为您提供正在运行的服务器。您也可以使用本地gradle安装代替项目中包含的包装器。最初的构建将花费一些时间,但是之后会有许多示例项目可以在其中运行,它们显示了XML名称空间和Java配置选项。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章