annotatedClasses:配置在sessionFactory下面表示的是,哪些实体需要映射,代码如下:

<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="myDataSource" />
<property name="annotatedClasses">
<list>
<value>com.jk.model.User</value>
<value>com.jk.model.Shop</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
</bean>

  

2.component-scan表示的是扫描哪些包来装配进我们的spring中,以供后面的配置调用,一般要和

<context:annotation-config />一起使用,表示的是启用注解配置。

示例如下:

 <context:annotation-config />
<context:component-scan base-package="com.jk" />

  

annotatedClasses和component-scan冲突吗的更多相关文章

  1. [Spring Boot] Use Component Scan to scan for Bean

    Component Scan is important concept when we want to create Bean. Currently we know what, for the cla ...

  2. 注解Annotation的IoC:从@Autowired到@Component

    注解Annotation的IoC:从@Autowired到@Component 2017-01-23 目录 1 什么是注解2 不使用注解示例  2.1 com.springioc.animal.Mon ...

  3. 关于 Spring Boot 中创建对象的疑虑 → @Bean 与 @Component 同时作用同一个类,会怎么样?

    开心一刻 今天放学回家,气愤愤地找到我妈 我:妈,我们班同学都说我五官长得特别平 妈:你小时候爱趴着睡觉 我:你怎么不把我翻过来呢 妈:那你不是凌晨2点时候出生的吗 我:嗯,凌晨2点出生就爱趴着睡觉呗 ...

  4. 基于Annotation的IOC 初始化

    从Spring2.0 以后的版本中,Spring 也引入了基于注解(Annotation)方式的配置,注解(Annotation)是JDK1.5 中引入的一个新特性,用于简化Bean 的配置,可以取代 ...

  5. SpingMVC 核心技术帮助文档

    声明:本篇文档主要是用于参考帮助文档,没有实例,但几乎包含了SpringMVC 4.2版本的所有核心技术,当前最新版本是4.3,4.2的版本已经经是很新的了,所以非常值得大家一读,对于读完这篇文档感觉 ...

  6. Spring 4 官方文档学习(十一)Web MVC 框架之配置Spring MVC

    内容列表: 启用MVC Java config 或 MVC XML namespace 修改已提供的配置 类型转换和格式化 校验 拦截器 内容协商 View Controllers View Reso ...

  7. @EnableWebMvc

    1.启用MVC Java config 或 MVC XML namespace 想要启用MVC Java config,只需要将@EnableWebMvc添加到你的一个@Configuration c ...

  8. spring源码分析之<context:component-scan/>vs<annotation-config/>

    1.<context:annotation-config/> xsd中说明: <xsd:element name="annotation-config"> ...

  9. 利用spring boot创建java app

    利用spring boot创建java app 背景 在使用spring框架开发的过程中,随着功能以及业务逻辑的日益复杂,应用伴随着大量的XML配置和复杂的bean依赖关系,特别是在使用mvc的时候各 ...

  10. annotation-config vs component-scan – Spring Core--转

    原文地址:http://techidiocy.com/annotation-config-vs-component-scan-spring-core/ <context:annotation-c ...

随机推荐

  1. 两个list 求交集效率对比

    __author__ = 'daitr' #--coding:utf-8-- import datetime #方法一: #a=[2,3,4,5] #b=[2,5,8] #tmp = [val for ...

  2. cxgrid footer summary value by a column

    var AIndex: integer; AValue: variant; begin with cxGrid1DBTableView1.DataController.Summary do begin ...

  3. How to install Hadoop

    1.How to install Hadoop 3.0.0 http://blog.sina.com.cn/s/blog_4a1f59bf01010kx3.html 2.How to install ...

  4. .htaccess 设置

     RewriteEngine on RewriteCond %{HTTP_HOST} ^blog.chosenet.com$RewriteCond %{REQUEST_URI} !^/blog/Rew ...

  5. 十五、mysql 分区之 分区管理

    1.mysql分区处理分区字段NULL值的方式 1.range分区null被当作最小值处理 2.list分区null值必须被枚举出来,否则将出错 3.hash/key分区 null值当作0处理 2.R ...

  6. GridView ItemCommand

    GridView ItemCommand中取某行某列的值方法,这里提供两个常用的: 一.用CommandArgument属性取值页面如下: <asp:TemplateColumn HeaderT ...

  7. 关于postgresql——常用操作指令

    创建数据库 CREATE DATABASE test WITH OWNER = postgres ENCODING = 'UTF8'; 进入控制台方法,在postgreSQL的安装目的bin下执行命令 ...

  8. ExtJS 添加图标icon

    extjs控件有两个属性:一个是iconCls:另一个是icon.通过这两个属性可以对控件添加图标 1.直接引用图标路径 icon: '../icons/application_view_detail ...

  9. 如何让VS根据编译环境选择相应的配置文件

    其实微软还是蛮有创造力的,一个配置文件居然弄了这么多的形式,从原来的ini到现在的xml,总而言之让我们这些在微软殿堂里的程序员翘着屁股追赶. 微软最新的配置文件实际上就是个xml文件,以后缀名.co ...

  10. [scalability] Find all documents that contain a list of words

    Given a list of millions of documents, how would you find all documents that contain a list of words ...