/*-
 * #%L
 * Secured Properties
 * ===============================================================
 * Copyright (C) 2016 - 2019 Brabenetz Harald, Austria
 * ===============================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package net.brabenetz.lib.securedproperties.snippets;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

//START SNIPPET: configExample
@SpringBootApplication
public class SpringBootStarterApplication {

    public static void main(String[] args) {
        securePasswords();
        SpringApplication.run(SpringBootStarterApplication.class, args);
    }

    private static void securePasswords() {
        // this will encrypt the given properties if there are not already encrypted:
        SpringBootSecuredPropertiesHelper.encryptProperties(
                "your.app.props.my-secret-password",
                "your.app.props.another-secret-password");
    }
}
//END SNIPPET: configExample

@@ -869,29 +869,82 @@
 rk.b
-oot.SpringApplication
+eans.factory.InitializingBean;%0Aimport org.springframework.boot.Banner.Mode
 ;%0Aim
@@ -1009,16 +1009,82 @@
 ication;
+%0Aimport org.springframework.boot.builder.SpringApplicationBuilder;
 %0A%0A//STAR
@@ -1233,151 +1233,749 @@
     
-securePasswords();%0A        SpringApplication.run(SpringBootStarterApplication.class, args);%0A    %7D%0A%0A    private static void securePasswords
+new SpringApplicationBuilder(SpringBootStarterApplication.class)%0A                .bannerMode(Mode.OFF) // banner already shown by the inner context -%3E no need to show it again.%0A                .parent(new SpringApplicationBuilder(AppPrepare.class) // the inner-Context runs first%0A                        // .banner(new YourAppBanner()) // replace SpringBoot Ascii-Art with your own (but don't tell Josh Long).%0A                        .run(args))%0A                .run(args);%0A    %7D%0A%0A    /**%0A     * Run the initialize in its own Spring-Boot-Context is needed to use the Spring-Boot backlog Logging config.%0A     */%0A    public static class AppPrepare implements InitializingBean %7B%0A        @Override%0A        public void afterPropertiesSet
 () %7B%0A
+    
     
@@ -2064,16 +2064,20 @@
         
+ 
+   
 SpringBo
@@ -2129,32 +2129,36 @@
                 
+    
 %22your.app.props.
@@ -2178,16 +2178,20 @@
 sword%22,%0A
+    
         
@@ -2241,16 +2241,26 @@
 word%22);%0A
+        %7D%0A
     %7D%0A%7D%0A

improve example to initial encrypt passwords with spring-boot.