0
我在appconfig文件中创建服务bean。如何用FactoryBean或其他方式创建这个bean,而不是一个一个地创建它?如何使用factorybean创建服务bean
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class })
@ComponentScan
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public SimpleService<Work> workService() { return new SimpleServiceImpl<Work>() { }; }
@Bean
public SimpleService<User> userService() { return new SimpleServiceImpl<User>() { }; }
@Bean
public SimpleService<Author> authorService() { return new SimpleServiceImpl<Author>() { }; }
@Bean
public SimpleService<Genre> genreService() { return new SimpleServiceImpl<Genre>() { }; }
@Bean
public SimpleService<BookCondition> bookConditionService() { return new SimpleServiceImpl<BookCondition>() { }; }
@Bean
public SimpleService<BookType> bookTypeService() { return new SimpleServiceImpl<BookType>() { }; }
@Bean
public SimpleService<Offer> offerService() { return new SimpleServiceImpl<Offer>() { }; }
除了这个服务,我只有genericService和genericsSvviseImpl。