rakesh kotian
rakesh kotian

Reputation: 128

Start ignite with spring boot in service on request

Spring boot requires to create a bean instance. Due to which the pods are started as I run the application

 @Bean
    Ignite ignite(IgniteConfiguration igniteConfiguration) {
        Ignition.start(igniteConfiguration)
    }

Is there any way that I can configure and start it in spring boot service on receiving a request?

Upvotes: 0

Views: 234

Answers (2)

alamar
alamar

Reputation: 19343

This is not recommended, because Ignite startup may be a lengthy process, and you probably don't want to wait for it upon getting a request (only to learn that startup failed, for example) and certainly not start it per request.

Also, consider using IgniteSpringBean instead of raw Ignite.

Upvotes: 1

Igor Belyakov
Igor Belyakov

Reputation: 885

You can add @Lazy annotation for bean declaration and also combine @Lazy with @Autowired annotation in your service.

More information here: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/annotation/Lazy.html

Upvotes: 1

Related Questions