import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
-// Limit the annotation scan to the dashboard classes;
-// exclude the generated client classes!
+// Using this package limits the annotation scan to the dashboard classes.
+// Do not want Spring to find the autowired annotations in the generated
+// classes.
@ComponentScan("org.oransc.ric.portal.dashboard")
public class DashboardApplication {
public static void main(String[] args) {
SpringApplication.run(DashboardApplication.class, args);
// Force this onto the console by using level WARN
- logger.warn("main: version '{}' successful start", getVersion());
+ logger.warn("main: version '{}' successful start",
+ getImplementationVersion(MethodHandles.lookup().lookupClass()));
}
/**
- * Gets version details.
+ * Gets version details for the specified class.
+ *
+ * @param clazz
+ * Class to get the version
*
* @return the value of the MANIFEST.MF property Implementation-Version as
* written by maven when packaged in a jar; 'unknown' otherwise.
*/
- private static String getVersion() {
- Class<?> clazz = MethodHandles.lookup().lookupClass();
+ public static String getImplementationVersion(Class<?> clazz) {
String classPath = clazz.getResource(clazz.getSimpleName() + ".class").toString();
- return classPath.startsWith("jar") ? clazz.getPackage().getImplementationVersion() : "unknown";
+ return classPath.startsWith("jar") ? clazz.getPackage().getImplementationVersion() : "unknown-not-jar";
}
}