https://issues.apache.org/jira/browse/CAMEL-9891
---
Luca Burgazzoli


On Wed, Apr 20, 2016 at 2:44 PM, Luca Burgazzoli <lburgazz...@gmail.com> wrote:
> mmh, yes if camel.springboot.main-run-controller is set to true,  the
> ApplicationReadyEvent is not sent, I will raise a JIRA
>
> ---
> Luca Burgazzoli
>
>
> On Wed, Apr 20, 2016 at 12:56 PM, Hubertus.Willuhn
> <hubertus.will...@dinsoftware.de> wrote:
>> Hi,
>>
>> Trying out your last solution seems to work, thx.
>>
>> *BUT*: I am now using your solution of my main() which looks like:
>>
>> @SpringBootApplication
>> @Import(Config.class)
>> public class App
>> {
>>         private static final Logger LOG = LoggerFactory.getLogger(App.class);
>>
>>         public static void main(String[] args) throws Exception
>>         {
>>                 try {
>>                         LOG.info("Shutdown Application by pressing Ctrl + 
>> C");
>>
>>                         SpringApplicationBuilder builder = new
>> SpringApplicationBuilder(App.class);
>>
>>                         // disable web "thinking"
>>                         builder.web(false);
>>
>>                         ConfigurableApplicationContext context = 
>> builder.run(args);
>>
>>                         PropertySource<?> props = new 
>> SimpleCommandLinePropertySource(args);
>>
>>                         if(props.containsProperty("dryrun")) {
>>                                 
>> LOG.info("---------------------------------------");
>>                                 LOG.info("DRY RUN, will now shutdown 
>> again.");
>>                                 
>> LOG.info("---------------------------------------");
>>
>>                                 if(context.isActive()) context.stop();
>>                         }
>>
>>                         LOG.info("{} ready.", App.class.getSimpleName());
>>
>>                         
>> context.getBean(CamelSpringBootApplicationController.class).run();
>>                 }
>>                 catch(Exception e) {
>>                         LOG.error("{} crashed, Reason: {}", 
>> App.class.getSimpleName(),
>> e.getMessage());
>>                         e.printStackTrace();
>>                 }
>>                 finally {
>>                         LOG.info("The Camel has left the building!");
>>                 }
>> ...
>>
>> So now this works and prints all logs *and* can be shutdown by Ctrl+C
>> (which seems not to work with plain SpringApplication.run(YourMain.class,
>> args)!?)
>>
>> Another interesting fact is, that i am using a CamelContextConfiguration in
>> my config class like:
>>
>>        @Bean
>>         public CamelContextConfiguration contextConfiguration()
>>         {
>>                 return new CamelContextConfiguration()
>>
>> The interface of the context configuration decribes two functions
>> "beforeApplicationStart" and "afterApplicationStart". The later will not be
>> executed if am using the new Property along with
>> SpringApplication.run(YourMain.class, args). This should be fixed!?
>>
>> Maybe that wasn't on your screen when adding the new behavior?
>>
>> If neccessary i will try to provide a basic sample application showing my
>> usecase, but i am very busy right now caching up patching my apps.
>>
>> Best regards,
>>
>> Hubertus
>>
>>
>>
>>
>>
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/Spring-Boot-and-Camel-2-17-HangupSupport-Removed-tp5781339p5781417.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to