public class MyClass() {
@Autowired
private ChromeService chromeService; (1)
private void someMethod() {
if (KosCore.isPrimary()) { (2)
}
}
}
This page serves as an introduction to many KOS services, which are software objects built into the KOS system that provides essential capabilities. They exists throughout the lifetime of your application.
Services are:
Singletons
Created by the KOS system
Exist in the system BeanContext
Accessed by either
instantiating them using the @Autowired annotation, or
accessing existing objects using the KosUtil static accessors.
Here’s an example of each:
public class MyClass() {
@Autowired
private ChromeService chromeService; (1)
private void someMethod() {
if (KosCore.isPrimary()) { (2)
}
}
}
1 | Autowiring the KOS-supplied ChromeService into your code |
2 | Using the global static accessor KosCore |
Of course, MyClass
must exist in the system’s BeanContext.