我的一个要求是在使用Spring Roo进行开发时实现身份验证。 我找到了gvNix及其典型的安全性,它看起来非常有前途。
然而,按照Typical security - getting started的例子,我无法让它发挥作用。
project --topLevelPackage com.testproject2 --projectName TestProject2
persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
typicalsecurity setup
<Exit gvNIX>>
mvn tomcat:run
问题:任何人都可以给我一个基本的。 欢迎任何帮助!
以下是命令行控制台的内容。
D:\Source\TypicalSecurity>\Tools\gvNIX-1.4.1\bin\gvnix.bat
____ ____ ____
/ __ \/ __ \/ __ \
/ /_/ / / / / / / /
/ _, _/ /_/ / /_/ / gvNIX 1.4.1.RELEASE distribution
/_/ |_|\____/\____/ 1.3.1.RELEASE [rev 8cb81a3]
Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.
roo-gvNIX> project --topLevelPackage com.testproject2 --projectName TestProject2
Created ROOT\pom.xml
Created SRC_MAIN_RESOURCES
Created SRC_MAIN_RESOURCES\log4j.properties
Created SPRING_CONFIG_ROOT
Created SPRING_CONFIG_ROOT\applicationContext.xml
roo-gvNIX> persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
Created SRC_MAIN_RESOURCES\dynamic-configuration.xml
Created SPRING_CONFIG_ROOT\database.properties
Updated SPRING_CONFIG_ROOT\applicationContext.xml
Created SRC_MAIN_RESOURCES\META-INF\persistence.xml
Updated ROOT\pom.xml [added dependencies org.hsqldb:hsqldb:2.2.9, org.hibernate:hibernate-core:4.3.6.Final, org.hibernate:hibernate-entitymanager:4.3.6.Final, org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final, commons-collections:commons-collections:3.2.1, org.hibernate:hibernate-validator:4.3.2.Final, javax.validation:validation-api:1.0.0.GA, javax.transaction:jta:1.1, org.springframework:spring-jdbc:${spring.version}, org.springframework:spring-orm:${spring.version}, commons-pool:commons-pool:1.5.6, commons-dbcp:commons-dbcp:1.4]
roo-gvNIX> typicalsecurity setup
Created SRC_MAIN_JAVA\com\testproject2\domain
Created SRC_MAIN_JAVA\com\testproject2\domain\User.java
Created SRC_TEST_JAVA\com\testproject2\domain
Created SRC_TEST_JAVA\com\testproject2\domain\UserDataOnDemand.java
Created SRC_TEST_JAVA\com\testproject2\domain\UserIntegrationTest.java
Updated ROOT\pom.xml [added dependency net.tanesha.recaptcha4j:recaptcha4j:0.0.7]
Created SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_Configurable.aj
Created SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_Jpa_Entity.aj
Created SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_Jpa_ActiveRecord.aj
Created SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_ToString.aj
Created SRC_TEST_JAVA\com\testproject2\domain\UserDataOnDemand_Roo_Configurable.aj
Created SRC_TEST_JAVA\com\testproject2\domain\UserDataOnDemand_Roo_DataOnDemand.aj
Created SRC_TEST_JAVA\com\testproject2\domain\UserIntegrationTest_Roo_Configurable.aj
Created SRC_TEST_JAVA\com\testproject2\domain\UserIntegrationTest_Roo_IntegrationTest.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User.java
Updated SRC_TEST_JAVA\com\testproject2\domain\UserDataOnDemand_Roo_DataOnDemand.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_Jpa_ActiveRecord.aj
Created SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_JavaBean.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User.java
Updated SRC_TEST_JAVA\com\testproject2\domain\UserDataOnDemand_Roo_DataOnDemand.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_Jpa_ActiveRecord.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_JavaBean.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User.java
Updated SRC_TEST_JAVA\com\testproject2\domain\UserDataOnDemand_Roo_DataOnDemand.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_Jpa_ActiveRecord.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_JavaBean.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User.java
Updated SRC_TEST_JAVA\com\testproject2\domain\UserDataOnDemand_Roo_DataOnDemand.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_Jpa_ActiveRecord.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_JavaBean.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User.java
Updated SRC_TEST_JAVA\com\testproject2\domain\UserDataOnDemand_Roo_DataOnDemand.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_Jpa_ActiveRecord.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_JavaBean.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User.java
Updated SRC_TEST_JAVA\com\testproject2\domain\UserDataOnDemand_Roo_DataOnDemand.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_Jpa_ActiveRecord.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_JavaBean.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User.java
Updated SRC_TEST_JAVA\com\testproject2\domain\UserDataOnDemand_Roo_DataOnDemand.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_Jpa_ActiveRecord.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_JavaBean.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User.java
Updated SRC_TEST_JAVA\com\testproject2\domain\UserDataOnDemand_Roo_DataOnDemand.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_Jpa_ActiveRecord.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_JavaBean.aj
Created SRC_MAIN_JAVA\com\testproject2\domain\Role.java
Created SRC_TEST_JAVA\com\testproject2\domain\RoleDataOnDemand.java
Created SRC_TEST_JAVA\com\testproject2\domain\RoleIntegrationTest.java
Created SRC_MAIN_JAVA\com\testproject2\domain\Role_Roo_Configurable.aj
Created SRC_MAIN_JAVA\com\testproject2\domain\Role_Roo_Jpa_Entity.aj
Created SRC_MAIN_JAVA\com\testproject2\domain\Role_Roo_Jpa_ActiveRecord.aj
Created SRC_MAIN_JAVA\com\testproject2\domain\Role_Roo_ToString.aj
Created SRC_TEST_JAVA\com\testproject2\domain\RoleIntegrationTest_Roo_Configurable.aj
Created SRC_TEST_JAVA\com\testproject2\domain\RoleDataOnDemand_Roo_DataOnDemand.aj
Created SRC_TEST_JAVA\com\testproject2\domain\RoleIntegrationTest_Roo_IntegrationTest.aj
Created SRC_TEST_JAVA\com\testproject2\domain\RoleDataOnDemand_Roo_Configurable.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\Role.java
Updated SRC_TEST_JAVA\com\testproject2\domain\RoleDataOnDemand_Roo_DataOnDemand.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\Role_Roo_Jpa_ActiveRecord.aj
Created SRC_MAIN_JAVA\com\testproject2\domain\Role_Roo_JavaBean.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\Role.java
Updated SRC_TEST_JAVA\com\testproject2\domain\RoleDataOnDemand_Roo_DataOnDemand.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\Role_Roo_Jpa_ActiveRecord.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\Role_Roo_JavaBean.aj
Created SRC_MAIN_JAVA\com\testproject2\domain\UserRole.java
Created SRC_TEST_JAVA\com\testproject2\domain\UserRoleDataOnDemand.java
Created SRC_TEST_JAVA\com\testproject2\domain\UserRoleIntegrationTest.java
Created SRC_MAIN_JAVA\com\testproject2\domain\UserRole_Roo_Configurable.aj
Created SRC_MAIN_JAVA\com\testproject2\domain\UserRole_Roo_Jpa_Entity.aj
Created SRC_MAIN_JAVA\com\testproject2\domain\UserRole_Roo_Jpa_ActiveRecord.aj
Created SRC_MAIN_JAVA\com\testproject2\domain\UserRole_Roo_ToString.aj
Created SRC_TEST_JAVA\com\testproject2\domain\UserRoleIntegrationTest_Roo_Configurable.aj
Created SRC_TEST_JAVA\com\testproject2\domain\UserRoleDataOnDemand_Roo_DataOnDemand.aj
Created SRC_TEST_JAVA\com\testproject2\domain\UserRoleIntegrationTest_Roo_IntegrationTest.aj
Created SRC_TEST_JAVA\com\testproject2\domain\UserRoleDataOnDemand_Roo_Configurable.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\UserRole.java
Updated SRC_TEST_JAVA\com\testproject2\domain\UserRoleDataOnDemand_Roo_DataOnDemand.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\UserRole_Roo_Jpa_ActiveRecord.aj
Created SRC_MAIN_JAVA\com\testproject2\domain\UserRole_Roo_JavaBean.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\UserRole.java
Updated SRC_TEST_JAVA\com\testproject2\domain\UserRoleDataOnDemand_Roo_DataOnDemand.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\UserRole_Roo_Jpa_ActiveRecord.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\UserRole_Roo_JavaBean.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User.java
Created SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_Finder.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\User.java
Updated SRC_MAIN_JAVA\com\testproject2\domain\User_Roo_Finder.aj
Updated SRC_MAIN_JAVA\com\testproject2\domain\UserRole.java
Created SRC_MAIN_JAVA\com\testproject2\domain\UserRole_Roo_Finder.aj
Command 'web mvc scaffold --class ~.web.UserController --backingType ~.domain.User' was found but is not currently available (type 'help' then ENTER to learn about this command)
Command 'web mvc scaffold --class ~.web.RoleController --backingType ~.domain.Role' was found but is not currently available (type 'help' then ENTER to learn about this command)
Command 'web mvc scaffold --class ~.web.UserRoleController --backingType ~.domain.UserRole' was found but is not currently available (type 'help' then ENTER to learn about this command)
Command 'security setup' was found but is not currently available (type 'help' then ENTER to learn about this command)
Created ROOT\src\main\webapp\WEB-INF\views\forgotpassword
Created ROOT\src\main\webapp\WEB-INF\views\forgotpassword\views.xml
Undo create ROOT\src\main\webapp\WEB-INF\views\forgotpassword\views.xml
Undo create ROOT\src\main\webapp\WEB-INF\views\forgotpassword
Could not acquire D:\Source\TypicalSecurity\src\main\webapp\WEB-INF/i18n/application.properties
~.domain.UserRole roo-gvNIX> exit
D:\Source\TypicalSecurity>mvn tomcat:run
[INFO] Scanning for projects...
Downloading: http://maven.springframework.org/release/org/apache/maven/plugins/maven-jar-plugin/2.4/maven-jar-plugin-2.4.pom
Downloading: http://maven.springframework.org/milestone/org/apache/maven/plugins/maven-jar-plugin/2.4/maven-jar-plugin-2.4.pom
Downloading: http://spring-roo-repository.springsource.org/release/org/apache/maven/plugins/maven-jar-plugin/2.4/maven-jar-plugin-2.4.pom
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-jar-plugin/2.4/maven-jar-plugin-2.4.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-jar-plugin/2.4/maven-jar-plugin-2.4.pom (6 KB at 14.2 KB/sec)
Downloading: http://maven.springframework.org/milestone/org/apache/maven/plugins/maven-metadata.xml
...
Downloaded: https://repo.maven.apache.org/maven2/net/tanesha/recaptcha4j/recaptcha4j/0.0.7/recaptcha4j-0.0.7.jar (11 KB at 196.2 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/hibernate/hibernate-entitymanager/4.3.6.Final/hibernate-entitymanager-4.3.6.Final.jar (632 KB at 1585.8 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/hibernate/hibernate-validator/4.3.2.Final/hibernate-validator-4.3.2.Final.jar (474 KB at 1467.2 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar (698 KB at 1453.0 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/hibernate/hibernate-core/4.3.6.Final/hibernate-core-4.3.6.Final.jar (5131 KB at 1960.6 KB/sec)
[INFO]
[INFO] --- aspectj-maven-plugin:1.4:compile (default) @ TestProject2 ---
Downloading: http://maven.springframework.org/release/org/aspectj/aspectjtools/1.8.1/aspectjtools-1.8.1.pom
Downloaded: http://maven.springframework.org/release/org/aspectj/aspectjtools/1.8.1/aspectjtools-1.8.1.pom (1022 B at 1.8 KB/sec)
Downloading: http://maven.springframework.org/release/org/aspectj/aspectjtools/1.8.1/aspectjtools-1.8.1.jar
Downloaded: http://maven.springframework.org/release/org/aspectj/aspectjtools/1.8.1/aspectjtools-1.8.1.jar (10721 KB at 972.1 KB/sec)
[WARNING] advice defined in org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch]
[WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
[WARNING] advice defined in org.springframework.scheduling.aspectj.AbstractAsyncExecutionAspect has not been applied [Xlint:adviceDidNotMatch]
[INFO]
[INFO] --- aspectj-maven-plugin:1.4:test-compile (default) @ TestProject2 ---
[WARNING] this affected type is not exposed to the weaver: com.testproject2.domain.Role [Xlint:typeNotExposedToWeaver]
[WARNING] this affected type is not exposed to the weaver: com.testproject2.domain.User [Xlint:typeNotExposedToWeaver]
[WARNING] this affected type is not exposed to the weaver: com.testproject2.domain.UserRole [Xlint:typeNotExposedToWeaver]
[WARNING] advice defined in org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect has not been applied [Xlint:adviceDidNotMatch]
[WARNING] advice defined in org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch]
[WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
[WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
[WARNING] advice defined in org.springframework.scheduling.aspectj.AbstractAsyncExecutionAspect has not been applied [Xlint:adviceDidNotMatch]
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ TestProject2 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ TestProject2 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< tomcat-maven-plugin:1.1:run (default-cli) < compile @ TestProject2 <<<
[INFO]
[INFO] --- tomcat-maven-plugin:1.1:run (default-cli) @ TestProject2 ---
[INFO] Skipping non-war project
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:00 min
[INFO] Finished at: 2015-06-09T18:59:50+02:00
[INFO] Final Memory: 14M/44M
[INFO] ------------------------------------------------------------------------
D:\Source\TypicalSecurity>
答案 0 :(得分:1)
此附加组件包含部分网页,因此需要安装Web mvc层。尝试以下命令序列:
// First run the petclinc roo example
script --file clinic.roo
// install typical security assets
typicalsecurity setup
如果您想要有关此功能的完整示例,请尝试以下操作:
txt
祝你好运!!