Question

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?

Était-ce utile?

La solution

@ComponentScan has a property nameGenerator.

Is it enough for you ?

UPDATE:

@ComponentScan(value = {"com.styxrbad", "com.styxrbad.common"}, nameGenerator = MyBeanNameGenerator.class)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top