문제

I'm working on updating an older Spring MVC application from xml based to annotation based configuration. I'm not sure how to add "name-generator" to the @ComponentScan annotation.

Here's what I have:

@Configuration
@EnableAsync
@EnableScheduling
@EnableAspectJAutoProxy
@ComponentScan({"com.styxrbad", "com.styxrbad.common"})
@Import({DatabaseConfiguration.class, WebMvcConfiguration.class})
public class SpringConfiguration
{

}

I need to include my implemented BeanNameGenerator to replace the "name-generator" field from the xml within the annotations. I'm rather new to Spring and I do not know the syntax nor can I find any examples in my research. How can I do this?

도움이 되었습니까?

해결책

@ComponentScan has a property nameGenerator.

Is it enough for you ?

UPDATE:

@ComponentScan(value = {"com.styxrbad", "com.styxrbad.common"}, nameGenerator = MyBeanNameGenerator.class)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top