Autowiring refactoring
This commit is contained in:
parent
842d2bf65d
commit
b55787b771
|
@ -20,7 +20,8 @@ public class ServletComponent implements WebServerFactoryCustomizer<TomcatServle
|
|||
* Autowired UtilitiesComponent object
|
||||
* Used for various utility functions
|
||||
*/
|
||||
private final UtilitiesComponent utilitiesComponent;
|
||||
@Autowired
|
||||
private UtilitiesComponent utilitiesComponent;
|
||||
|
||||
/**
|
||||
* Customizes port of application
|
||||
|
@ -47,15 +48,4 @@ public class ServletComponent implements WebServerFactoryCustomizer<TomcatServle
|
|||
tomcatServletWebServerFactory.setPort(Ward.INITIAL_PORT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for autowiring necessary objects
|
||||
*
|
||||
* @param utilitiesComponent autowired UtilitiesComponent object
|
||||
*/
|
||||
@Autowired
|
||||
public ServletComponent(UtilitiesComponent utilitiesComponent)
|
||||
{
|
||||
this.utilitiesComponent = utilitiesComponent;
|
||||
}
|
||||
}
|
|
@ -21,7 +21,8 @@ public class ErrorController implements org.springframework.boot.web.servlet.err
|
|||
* Autowired ErrorService object
|
||||
* Used to determine error page
|
||||
*/
|
||||
private final ErrorService errorService;
|
||||
@Autowired
|
||||
private ErrorService errorService;
|
||||
|
||||
/**
|
||||
* Get request to display error page, which corresponds status code
|
||||
|
@ -44,15 +45,4 @@ public class ErrorController implements org.springframework.boot.web.servlet.err
|
|||
{
|
||||
return "/error";
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for autowiring necessary objects
|
||||
*
|
||||
* @param errorService autowired ErrorService object
|
||||
*/
|
||||
@Autowired
|
||||
public ErrorController(ErrorService errorService)
|
||||
{
|
||||
this.errorService = errorService;
|
||||
}
|
||||
}
|
|
@ -21,7 +21,8 @@ public class IndexController
|
|||
* Autowired IndexService object
|
||||
* Used for getting index page template
|
||||
*/
|
||||
private final IndexService indexService;
|
||||
@Autowired
|
||||
private IndexService indexService;
|
||||
|
||||
/**
|
||||
* Get request to display index page
|
||||
|
@ -34,15 +35,4 @@ public class IndexController
|
|||
{
|
||||
return indexService.getIndex(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for autowiring necessary objects
|
||||
*
|
||||
* @param indexService autowired IndexService object
|
||||
*/
|
||||
@Autowired
|
||||
public IndexController(IndexService indexService)
|
||||
{
|
||||
this.indexService = indexService;
|
||||
}
|
||||
}
|
|
@ -22,7 +22,8 @@ public class InfoController
|
|||
* Autowired InfoService object
|
||||
* Used for getting information about server
|
||||
*/
|
||||
private final InfoService infoService;
|
||||
@Autowired
|
||||
private InfoService infoService;
|
||||
|
||||
/**
|
||||
* Get request to display current usage information for processor, RAM and storage
|
||||
|
@ -34,15 +35,4 @@ public class InfoController
|
|||
{
|
||||
return new ResponseEntity<>(infoService.getInfo(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for autowiring necessary objects
|
||||
*
|
||||
* @param infoService autowired InfoService object
|
||||
*/
|
||||
@Autowired
|
||||
public InfoController(InfoService infoService)
|
||||
{
|
||||
this.infoService = infoService;
|
||||
}
|
||||
}
|
|
@ -22,7 +22,8 @@ public class SetupController
|
|||
* Autowired SetupService object
|
||||
* Used for posting settings information in ini file
|
||||
*/
|
||||
private final SetupService setupService;
|
||||
@Autowired
|
||||
private SetupService setupService;
|
||||
|
||||
/**
|
||||
* Posting setup info in database
|
||||
|
@ -35,15 +36,4 @@ public class SetupController
|
|||
{
|
||||
return new ResponseEntity<>(setupService.postSetup(setupDto), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for autowiring necessary objects
|
||||
*
|
||||
* @param setupService autowired SettingsService object
|
||||
*/
|
||||
@Autowired
|
||||
public SetupController(SetupService setupService)
|
||||
{
|
||||
this.setupService = setupService;
|
||||
}
|
||||
}
|
|
@ -23,7 +23,8 @@ public class UsageController
|
|||
* Autowired UsageService object
|
||||
* Used for getting usage information
|
||||
*/
|
||||
private final UsageService usageService;
|
||||
@Autowired
|
||||
private UsageService usageService;
|
||||
|
||||
/**
|
||||
* Get request to display current usage information for processor, RAM and storage
|
||||
|
@ -35,15 +36,4 @@ public class UsageController
|
|||
{
|
||||
return new ResponseEntity<>(usageService.getUsage(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for autowiring necessary objects
|
||||
*
|
||||
* @param usageService autowired UsageService object
|
||||
*/
|
||||
@Autowired
|
||||
public UsageController(UsageService usageService)
|
||||
{
|
||||
this.usageService = usageService;
|
||||
}
|
||||
}
|
|
@ -29,7 +29,8 @@ public class ControllerExceptionHandler
|
|||
* Autowired UtilitiesComponent object
|
||||
* Used for various utility functions
|
||||
*/
|
||||
private final UtilitiesComponent utilitiesComponent;
|
||||
@Autowired
|
||||
private UtilitiesComponent utilitiesComponent;
|
||||
|
||||
/**
|
||||
* Handles ApplicationNotSetUpException, then it thrown
|
||||
|
@ -63,15 +64,4 @@ public class ControllerExceptionHandler
|
|||
|
||||
return "error/500";
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for autowiring necessary objects
|
||||
*
|
||||
* @param utilitiesComponent autowired UtilitiesComponent object
|
||||
*/
|
||||
@Autowired
|
||||
public ControllerExceptionHandler(UtilitiesComponent utilitiesComponent)
|
||||
{
|
||||
this.utilitiesComponent = utilitiesComponent;
|
||||
}
|
||||
}
|
|
@ -20,7 +20,8 @@ public class ErrorService
|
|||
* Autowired UtilitiesComponent object
|
||||
* Used for various utility functions
|
||||
*/
|
||||
private final UtilitiesComponent utilitiesComponent;
|
||||
@Autowired
|
||||
private UtilitiesComponent utilitiesComponent;
|
||||
|
||||
/**
|
||||
* Returns 404 error page
|
||||
|
@ -39,15 +40,4 @@ public class ErrorService
|
|||
model.addAttribute("theme", utilitiesComponent.getThemeName());
|
||||
return "error/404";
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for autowiring necessary objects
|
||||
*
|
||||
* @param utilitiesComponent autowired UtilitiesComponent object
|
||||
*/
|
||||
@Autowired
|
||||
public ErrorService(UtilitiesComponent utilitiesComponent)
|
||||
{
|
||||
this.utilitiesComponent = utilitiesComponent;
|
||||
}
|
||||
}
|
|
@ -19,13 +19,15 @@ public class IndexService
|
|||
* Autowired InfoService object
|
||||
* Used for getting machine information for html template
|
||||
*/
|
||||
private final InfoService infoService;
|
||||
@Autowired
|
||||
private InfoService infoService;
|
||||
|
||||
/**
|
||||
* Autowired UtilitiesComponent object
|
||||
* Used for various utility functions
|
||||
*/
|
||||
private final UtilitiesComponent utilitiesComponent;
|
||||
@Autowired
|
||||
private UtilitiesComponent utilitiesComponent;
|
||||
|
||||
/**
|
||||
* Fills model and returns template name
|
||||
|
@ -45,17 +47,4 @@ public class IndexService
|
|||
|
||||
return "index";
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for autowiring necessary objects
|
||||
*
|
||||
* @param infoService autowired InfoService object
|
||||
* @param utilitiesComponent autowired UtilitiesComponent object
|
||||
*/
|
||||
@Autowired
|
||||
public IndexService(InfoService infoService, UtilitiesComponent utilitiesComponent)
|
||||
{
|
||||
this.infoService = infoService;
|
||||
this.utilitiesComponent = utilitiesComponent;
|
||||
}
|
||||
}
|
|
@ -27,13 +27,15 @@ public class InfoService
|
|||
* Autowired SystemInfo object
|
||||
* Used for getting machine information
|
||||
*/
|
||||
private final SystemInfo systemInfo;
|
||||
@Autowired
|
||||
private SystemInfo systemInfo;
|
||||
|
||||
/**
|
||||
* Autowired UtilitiesComponent object
|
||||
* Used for various utility functions
|
||||
*/
|
||||
private final UtilitiesComponent utilitiesComponent;
|
||||
@Autowired
|
||||
private UtilitiesComponent utilitiesComponent;
|
||||
|
||||
/**
|
||||
* Converts frequency to most readable format
|
||||
|
@ -269,17 +271,4 @@ public class InfoService
|
|||
throw new ApplicationNotSetUpException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for autowiring necessary objects
|
||||
*
|
||||
* @param systemInfo autowired SystemInfo object
|
||||
* @param utilitiesComponent autowired Utilities object
|
||||
*/
|
||||
@Autowired
|
||||
public InfoService(SystemInfo systemInfo, UtilitiesComponent utilitiesComponent)
|
||||
{
|
||||
this.systemInfo = systemInfo;
|
||||
this.utilitiesComponent = utilitiesComponent;
|
||||
}
|
||||
}
|
|
@ -26,7 +26,8 @@ public class UsageService
|
|||
* Autowired SystemInfo object
|
||||
* Used for getting usage information
|
||||
*/
|
||||
private final SystemInfo systemInfo;
|
||||
@Autowired
|
||||
private SystemInfo systemInfo;
|
||||
|
||||
/**
|
||||
* Gets processor usage
|
||||
|
@ -102,15 +103,4 @@ public class UsageService
|
|||
throw new ApplicationNotSetUpException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for autowiring necessary objects
|
||||
*
|
||||
* @param systemInfo autowired SystemInfo object
|
||||
*/
|
||||
@Autowired
|
||||
public UsageService(SystemInfo systemInfo)
|
||||
{
|
||||
this.systemInfo = systemInfo;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue