2
私はSpring Bootの新機能です。Spring Boot:CommandLineRunnerのインスタンスを多く渡すのは安全ですか?
@SpringBootApplication(exclude = JpaRepositoriesAutoConfiguration.class)
public class Application {
private static final Logger log = LoggerFactory.getLogger(Application.class);
...
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
@Bean
public CommandLineRunner App(DBReportRepository dbReportRepository,
ClientRepository clientRepository, FileParser fileParser,
MessagingService messagingService, ClientReportFactoryImpl clientReportFactory) ...
私は思っていたことがCommandLineRunnerに(クラスを注釈付き@Servicesある)ので、多くのパラメータを渡すことをお勧めです:私は、私はいくつかのコードを持っているApplication.javaクラスが持っています。
また、私はSpring Bootをあまりにも多く作成していますが、Spring Bootにこれらの@Servicesクラスを認識させる別の方法があります。