
0关注
552
文章
0
收藏
2
次赞
214532
查看
Ta的博客 更多
SpringBoot 五种获取ApplicationContext的方式java中进行日期时间比较的4种方法SpringBoot整合WebSocket实现前后端互推消息CSS怎么画五角星?SpringBoot中RedisUtils工具类配置及直接使用什么是 JavaConfig?
JavaConfig是Spring3.0新增的概念,就是以注解的形式取代Spring中繁琐的xml文件。
JavaConfig结合了xml的解耦和java编译时检查的优点。
@Configuration,表示这个类是配置类;
@ComponentScan,相当于xml的<context:componentScan basepackage=>;
@Bean,相当于xml的<bean id="student" class="com.guor.entity">;
@EnableWebMvc,相当于xml的<mvc:annotation-driven>;
@ImportResource,相当于xml的<import resource="application-context-cache.xml">;
@PropertySource,用于读取properties配置文件;
@Profile,一般用于多环境配置,激活时可用@ActiveProfile("dev")注解;
JavaConfig结合了xml的解耦和java编译时检查的优点。
@Configuration,表示这个类是配置类;
@ComponentScan,相当于xml的<context:componentScan basepackage=>;
@Bean,相当于xml的<bean id="student" class="com.guor.entity">;
@EnableWebMvc,相当于xml的<mvc:annotation-driven>;
@ImportResource,相当于xml的<import resource="application-context-cache.xml">;
@PropertySource,用于读取properties配置文件;
@Profile,一般用于多环境配置,激活时可用@ActiveProfile("dev")注解;
0 0