1 个回答
常用的java config有:
@Configuration:在类上打上写下此注解,表示这个类是配置类
@ComponentScan:在配置类上添加 @ComponentScan 注解。该注解默认会扫描该类所在的包下所有的配置类,相当于之前的 <context:component-scan >。
@Bean:bean的注入:相当于以前的< bean id=“objectMapper”
class=“org.codehaus.jackson.map.ObjectMapper” />
@EnableWebMvc:相当于xml的<mvc:annotation-driven >
@ImportResource: 相当于xml的 < import resource=“applicationContextcache.xml”>
发布于:1周前 (04-21) IP属地:四川省
我来回答
您需要 登录 后回答此问题!