最近学习jeecgv3.0框架,在这里感谢张代浩提供了这么一个优秀的框架。
1、jeecg中jeecg_config.properties中代码生成器自定义的包名是“bussi_package=jeecg.test”,如果改成非jeecg开头的包名,会出现一系列异常,这时我改成“bussi_package=com.enetion”。生成的是教程中的person
2、启动tomcat,会出现
[org.springframework.web.servlet.PageNotFound]No mapping found for HTTP request with URI [/jeecg/personController.do] in DispatcherServlet with name 'springMvc'
3、这是spring没有扫描到com包导致的,修改Spring-mvc.xml,增加
<context:component-scan base-package="com.*">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service" />
</context:component-scan>
4、重新启动,会出现异常:
[org.springframework.core.type.classreading.AnnotationAttributesReadingVisitor]Failed to classload type while reading annotation metadata. This is a non-fatal error, but certain annotation metadata may be unavailable.
java.lang.ClassNotFoundException: org.testng.annotations.AfterTest
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.springframework.core.type.classreading.RecursiveAnnotationAttributesVisitor.visitEnd(AnnotationAttributesReadingVisitor.java:167)
at org.springframework.asm.ClassReader.a(Unknown Source)
at org.springframework.asm.ClassReader.accept(Unknown Source)
at org.springframework.asm.ClassReader.accept(Unknown Source)
5、需要增加testng的jar包,包可以在附件下载
6、再重启,会出现异常
No matching bean of type [com.enetion.service.person.PersonServiceI] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
这是由于Spring-mvc-hibernate.xml没有配置,增加以下配置
<context:component-scan base-package="com.*">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
</context:component-scan>
在注解方式配置处增加你的entity包
<!-- 注解方式配置 -->
<property name="packagesToScan">
<list>
<value>jeecg.system.pojo.*</value>
<value>jeecg.demo.entity.*</value>
<value>jeecg.test.entity.*</value>
<value>com.enetion.entity.*</value>
</list>
</property>