关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、418799587 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 18798|回复: 3

[环境搭建] 关于springmvc的bean配置无法找到

[复制链接]
发表于 2013-12-23 16:48:30 | 显示全部楼层 |阅读模式
我对SPRINGMVC框架不熟,以前没用过,对于定义页面转向一直没有发现从哪配置,还有许多BEAN文件定义也没找到从哪定义的。看着服务器启动时候加载了几个XML文件,但都没有找到相关BEAN的定义。
<servlet>
<description>spring mvc servlet</description>
<servlet-name>springMvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<description>spring mvc 配置文件</description>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

spring-mvc.xml这个里面又引入<import resource="classpath*:jeecg/cgform/common/spring-mvc-cgform.xml" />

但在这两个里面很多BEAN找不到,比如:jeecgOrderMainService

[org.springframework.beans.factory.support.DefaultListableBeanFactory]Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@143ccf5: defining beans [genericBaseCommonDao,miniDaoHandler,org.jeecgframework.minidao.factory.MiniDaoBeanFactory#0,
org.springframework.aop.config.internalAutoProxyCreator,logInterceptor,
org.springframework.context.annotation.internalConfigurationAnnotationProcessor,
org.springframework.context.annotation.internalAutowiredAnnotationProcessor,
org.springframework.context.annotation.internalRequiredAnnotationProcessor,
org.springframework.context.annotation.internalCommonAnnotationProcessor,
org.springframework.context.annotation.internalPersistenceAnnotationProcessor,
ehcacheAspect,hiberAspect,commonDao,jdbcDao,commonService,courseService,jeecgBlobDataService,
jeecgDemoCkfinderService,jeecgDemoService,jeecgJdbcService,jeecgMatterBomService,jeecgNoteService,
jeecgOrderMainService,jpPersonService,optimisticLockingService,taskDemoService,tFinanceService,
webOfficeService,declareService,menuInitService,repairService,systemService,timeTaskService,userService,
cgUploadService,cgReportExcelService,dictDataTag,cgformButtonSqlService,cgformButtonService,
cgTableService,configService,dataBaseService,templetLoader,templetContext,cgformenhanceJsService,
cgFormFieldService,cgReportService,cgformFtlService,MigrateForm,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,
dataSource_jeecg,dataSource,sessionFactory,jdbcTemplate,namedParameterJdbcTemplate,transactionManager,
org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,
org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,
dynamicTask,job,executor,scheduler,org.springframework.context.annotation.internalAsyncAnnotationProcessor,
org.springframework.context.annotation.internalScheduledAnnotationProcessor,taskDemoServiceTaskJob,taskDemoServiceTaskCronTrigger,
schedulerFactory,courseController,demoController,jeecgBlobDataController,jeecgDemoCkfinderController,jeecgDemoController,
jeecgEasyUIController,jeecgJdbcController,jeecgMatterBomController,jeecgNoteController,jeecgOrderMainController,
jeecgOrderMainNoTagController,jpPersonController,optimisticLockingController,reportDemoController,TFinanceController,
userNoPageController,webOfficeController,commonController,configController,dataSourceController,departController,duplicateCheckAction,
functionController,iconController,logController,loginController,repairController,roleController,systemController,territoryController,timeTaskController,
userController,cgReportController,cgformButtonSqlController,cgformButtonController,cgAutoListController,cgFormBuildController,cgformSqlController,
cgformFtlController,cgUploadController,cgExportExcelController,cgformEnhanceJsController,excelTempletController,generateController,
cgFormHeadController,cgformTransController,org.jeecgframework.core.util.ApplicationContextUtil#0,mappingJacksonHttpMessageConverter,
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,defaultViewResolver,multipartResolver,dialect,exceptionHandler,
org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#0,org.springframework.web.servlet.handler.MappedInterceptor#0,
org.springframework.web.servlet.handler.MappedInterceptor#1,freemarker,org.springframework.web.servlet.handler.MappedInterceptor#2,
org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy


发表于 2013-12-23 17:25:12 | 显示全部楼层
springmvc的设置仅设置一个,会自动扫描其他的
 楼主| 发表于 2013-12-23 19:12:23 | 显示全部楼层
不大明白能详细讲解一下吗?谢谢
 楼主| 发表于 2013-12-23 19:41:16 | 显示全部楼层
从网上找到了,谢谢,知道怎么加载了

Spring 2.5引入了更多典型化注解(stereotype annotations): @Component、@Service和 @Controller。@Component是所有受Spring管理组件的通用形式;而@Repository、@Service和 @Controller则是@Component的细化,用来表示更具体的用例(例如,分别对应了持久化层、服务层和表现层)。也就是说,你能用@Component来注解你的组件类,但如果用@Repository、@Service 或@Controller来注解它们,你的类也许能更好地被工具处理,或与切面进行关联。例如,这些典型化注解可以成为理想的切入点目标。当然,在Spring Framework以后的版本中, @Repository、@Service和 @Controller也许还能携带更多语义。如此一来,如果你正在考虑服务层中是该用@Component还是@Service,那@Service显然是更好的选择。同样的,就像前面说的那样, @Repository已经能在持久化层中进行异常转换时被作为标记使用了。”
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表