All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.gitee.putaoo.easypay.config.PaymentConfig Maven / Gradle / Ivy

package io.gitee.putaoo.easypay.config;

import io.gitee.putaoo.easypay.handler.PayHandler;
import io.gitee.putaoo.easypay.service.PaymentService;
import io.gitee.putaoo.easypay.service.impl.PaymentServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;
import java.util.stream.Collectors;

@Configuration
public class PaymentConfig {

    @Bean
    PaymentService paymentService(ApplicationContext applicationContext){
        List payHandlers = applicationContext
                .getBeanProvider(PayHandler.class)
                .orderedStream()
                .collect(Collectors.toList());

        return new PaymentServiceImpl(payHandlers);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy