File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed 
src/main/java/br/com/concrete/mock/configuration/api/v1/controller Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change 66import  org .slf4j .LoggerFactory ;
77import  org .springframework .beans .factory .annotation .Autowired ;
88import  org .springframework .beans .factory .annotation .Value ;
9+ import  org .springframework .boot .CommandLineRunner ;
10+ import  org .springframework .context .annotation .Bean ;
911import  org .springframework .http .HttpStatus ;
1012import  org .springframework .http .ResponseEntity ;
1113import  org .springframework .web .bind .annotation .*;
1214
13- import  javax .annotation .PostConstruct ;
14- 
1515@ RestController 
1616@ RequestMapping ("/configuration/capture-state" )
1717public  class  CaptureStateController  {
@@ -28,13 +28,14 @@ public CaptureStateController(CaptureStateService service) {
2828        this .service  = service ;
2929    }
3030
31-     @ PostConstruct 
32-     public  void  init  (){
33- 
34-         LOGGER .info ("Application capture state: "  + captureState );
35-         if (captureState ){
36-             this .service .enable ();
37-         }
31+     @ Bean 
32+     private  CommandLineRunner  onLoad () {
33+         return  args  -> {
34+             LOGGER .info ("Application capture state: "  + captureState );
35+             if (captureState ) {
36+                 this .service .enable ();
37+             }
38+         };
3839    }
3940
4041    @ RequestMapping (method  = RequestMethod .GET )
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments