` to any timeseries scraped from this config.
+ - job_name: 'prometheus'
+
+ # Override the global default and scrape targets from this job every 5 seconds.
+ scrape_interval: 5s
+
+ # scheme defaults to 'http' enable https in case your application is server via https
+ #scheme: https
+ # basic auth is not needed by default. See https://www.jhipster.tech/monitoring/#configuring-metrics-forwarding for details
+ #basic_auth:
+ # username: admin
+ # password: admin
+ metrics_path: /management/prometheus
+ static_configs:
+ - targets:
+ # On MacOS, replace localhost by host.docker.internal
+ - localhost:8080
diff --git a/NYCEtube/src/main/docker/sonar.yml b/NYCEtube/src/main/docker/sonar.yml
new file mode 100644
index 000000000..6fbdc83be
--- /dev/null
+++ b/NYCEtube/src/main/docker/sonar.yml
@@ -0,0 +1,13 @@
+# This configuration is intended for development purpose, it's **your** responsibility to harden it for production
+version: '3.8'
+services:
+ nycetube-sonar:
+ image: sonarqube:9.3.0-community
+ # Authentication is turned off for out of the box experience while trying out SonarQube
+ # For real use cases delete sonar.forceAuthentication variable or set sonar.forceAuthentication=true
+ environment:
+ - sonar.forceAuthentication=false
+ # If you want to expose these ports outside your dev PC,
+ # remove the "127.0.0.1:" prefix
+ ports:
+ - 127.0.0.1:9001:9000
diff --git a/NYCEtube/src/main/docker/zipkin.yml b/NYCEtube/src/main/docker/zipkin.yml
new file mode 100644
index 000000000..07938b9e1
--- /dev/null
+++ b/NYCEtube/src/main/docker/zipkin.yml
@@ -0,0 +1,7 @@
+# This configuration is intended for development purpose, it's **your** responsibility to harden it for production
+version: '3.8'
+services:
+ zipkin:
+ image: openzipkin/zipkin:2.23
+ ports:
+ - 127.0.0.1:9411:9411
diff --git a/NYCEtube/src/main/java/com/nyce/tube/ApplicationWebXml.java b/NYCEtube/src/main/java/com/nyce/tube/ApplicationWebXml.java
new file mode 100644
index 000000000..58c4e54bb
--- /dev/null
+++ b/NYCEtube/src/main/java/com/nyce/tube/ApplicationWebXml.java
@@ -0,0 +1,19 @@
+package com.nyce.tube;
+
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+import tech.jhipster.config.DefaultProfileUtil;
+
+/**
+ * This is a helper Java class that provides an alternative to creating a {@code web.xml}.
+ * This will be invoked only when the application is deployed to a Servlet container like Tomcat, JBoss etc.
+ */
+public class ApplicationWebXml extends SpringBootServletInitializer {
+
+ @Override
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+ // set a default to use when no profile is configured.
+ DefaultProfileUtil.addDefaultProfile(application.application());
+ return application.sources(NycEtubeApp.class);
+ }
+}
diff --git a/NYCEtube/src/main/java/com/nyce/tube/GeneratedByJHipster.java b/NYCEtube/src/main/java/com/nyce/tube/GeneratedByJHipster.java
new file mode 100644
index 000000000..2fe2f0ebd
--- /dev/null
+++ b/NYCEtube/src/main/java/com/nyce/tube/GeneratedByJHipster.java
@@ -0,0 +1,13 @@
+package com.nyce.tube;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.annotation.Generated;
+
+@Generated(value = "JHipster", comments = "Generated by JHipster 7.8.1")
+@Retention(RetentionPolicy.SOURCE)
+@Target({ ElementType.TYPE })
+public @interface GeneratedByJHipster {
+}
diff --git a/NYCEtube/src/main/java/com/nyce/tube/NycEtubeApp.java b/NYCEtube/src/main/java/com/nyce/tube/NycEtubeApp.java
new file mode 100644
index 000000000..64c81155c
--- /dev/null
+++ b/NYCEtube/src/main/java/com/nyce/tube/NycEtubeApp.java
@@ -0,0 +1,103 @@
+package com.nyce.tube;
+
+import com.nyce.tube.config.ApplicationProperties;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Optional;
+import javax.annotation.PostConstruct;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.core.env.Environment;
+import tech.jhipster.config.DefaultProfileUtil;
+import tech.jhipster.config.JHipsterConstants;
+
+@SpringBootApplication
+@EnableConfigurationProperties({ LiquibaseProperties.class, ApplicationProperties.class })
+public class NycEtubeApp {
+
+ private static final Logger log = LoggerFactory.getLogger(NycEtubeApp.class);
+
+ private final Environment env;
+
+ public NycEtubeApp(Environment env) {
+ this.env = env;
+ }
+
+ /**
+ * Initializes NYCEtube.
+ *
+ * Spring profiles can be configured with a program argument --spring.profiles.active=your-active-profile
+ *
+ * You can find more information on how profiles work with JHipster on https://www.jhipster.tech/profiles/.
+ */
+ @PostConstruct
+ public void initApplication() {
+ Collection activeProfiles = Arrays.asList(env.getActiveProfiles());
+ if (
+ activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) &&
+ activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION)
+ ) {
+ log.error(
+ "You have misconfigured your application! It should not run " + "with both the 'dev' and 'prod' profiles at the same time."
+ );
+ }
+ if (
+ activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) &&
+ activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_CLOUD)
+ ) {
+ log.error(
+ "You have misconfigured your application! It should not " + "run with both the 'dev' and 'cloud' profiles at the same time."
+ );
+ }
+ }
+
+ /**
+ * Main method, used to run the application.
+ *
+ * @param args the command line arguments.
+ */
+ public static void main(String[] args) {
+ SpringApplication app = new SpringApplication(NycEtubeApp.class);
+ DefaultProfileUtil.addDefaultProfile(app);
+ Environment env = app.run(args).getEnvironment();
+ logApplicationStartup(env);
+ }
+
+ private static void logApplicationStartup(Environment env) {
+ String protocol = Optional.ofNullable(env.getProperty("server.ssl.key-store")).map(key -> "https").orElse("http");
+ String serverPort = env.getProperty("server.port");
+ String contextPath = Optional
+ .ofNullable(env.getProperty("server.servlet.context-path"))
+ .filter(StringUtils::isNotBlank)
+ .orElse("/");
+ String hostAddress = "localhost";
+ try {
+ hostAddress = InetAddress.getLocalHost().getHostAddress();
+ } catch (UnknownHostException e) {
+ log.warn("The host name could not be determined, using `localhost` as fallback");
+ }
+ log.info(
+ "\n----------------------------------------------------------\n\t" +
+ "Application '{}' is running! Access URLs:\n\t" +
+ "Local: \t\t{}://localhost:{}{}\n\t" +
+ "External: \t{}://{}:{}{}\n\t" +
+ "Profile(s): \t{}\n----------------------------------------------------------",
+ env.getProperty("spring.application.name"),
+ protocol,
+ serverPort,
+ contextPath,
+ protocol,
+ hostAddress,
+ serverPort,
+ contextPath,
+ env.getActiveProfiles().length == 0 ? env.getDefaultProfiles() : env.getActiveProfiles()
+ );
+ }
+}
diff --git a/NYCEtube/src/main/java/com/nyce/tube/aop/logging/LoggingAspect.java b/NYCEtube/src/main/java/com/nyce/tube/aop/logging/LoggingAspect.java
new file mode 100644
index 000000000..99921db10
--- /dev/null
+++ b/NYCEtube/src/main/java/com/nyce/tube/aop/logging/LoggingAspect.java
@@ -0,0 +1,111 @@
+package com.nyce.tube.aop.logging;
+
+import java.util.Arrays;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.AfterThrowing;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.env.Environment;
+import org.springframework.core.env.Profiles;
+import tech.jhipster.config.JHipsterConstants;
+
+/**
+ * Aspect for logging execution of service and repository Spring components.
+ *
+ * By default, it only runs with the "dev" profile.
+ */
+@Aspect
+public class LoggingAspect {
+
+ private final Environment env;
+
+ public LoggingAspect(Environment env) {
+ this.env = env;
+ }
+
+ /**
+ * Pointcut that matches all repositories, services and Web REST endpoints.
+ */
+ @Pointcut(
+ "within(@org.springframework.stereotype.Repository *)" +
+ " || within(@org.springframework.stereotype.Service *)" +
+ " || within(@org.springframework.web.bind.annotation.RestController *)"
+ )
+ public void springBeanPointcut() {
+ // Method is empty as this is just a Pointcut, the implementations are in the advices.
+ }
+
+ /**
+ * Pointcut that matches all Spring beans in the application's main packages.
+ */
+ @Pointcut("within(com.nyce.tube.repository..*)" + " || within(com.nyce.tube.service..*)" + " || within(com.nyce.tube.web.rest..*)")
+ public void applicationPackagePointcut() {
+ // Method is empty as this is just a Pointcut, the implementations are in the advices.
+ }
+
+ /**
+ * Retrieves the {@link Logger} associated to the given {@link JoinPoint}.
+ *
+ * @param joinPoint join point we want the logger for.
+ * @return {@link Logger} associated to the given {@link JoinPoint}.
+ */
+ private Logger logger(JoinPoint joinPoint) {
+ return LoggerFactory.getLogger(joinPoint.getSignature().getDeclaringTypeName());
+ }
+
+ /**
+ * Advice that logs methods throwing exceptions.
+ *
+ * @param joinPoint join point for advice.
+ * @param e exception.
+ */
+ @AfterThrowing(pointcut = "applicationPackagePointcut() && springBeanPointcut()", throwing = "e")
+ public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
+ if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT))) {
+ logger(joinPoint)
+ .error(
+ "Exception in {}() with cause = '{}' and exception = '{}'",
+ joinPoint.getSignature().getName(),
+ e.getCause() != null ? e.getCause() : "NULL",
+ e.getMessage(),
+ e
+ );
+ } else {
+ logger(joinPoint)
+ .error(
+ "Exception in {}() with cause = {}",
+ joinPoint.getSignature().getName(),
+ e.getCause() != null ? e.getCause() : "NULL"
+ );
+ }
+ }
+
+ /**
+ * Advice that logs when a method is entered and exited.
+ *
+ * @param joinPoint join point for advice.
+ * @return result.
+ * @throws Throwable throws {@link IllegalArgumentException}.
+ */
+ @Around("applicationPackagePointcut() && springBeanPointcut()")
+ public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
+ Logger log = logger(joinPoint);
+ if (log.isDebugEnabled()) {
+ log.debug("Enter: {}() with argument[s] = {}", joinPoint.getSignature().getName(), Arrays.toString(joinPoint.getArgs()));
+ }
+ try {
+ Object result = joinPoint.proceed();
+ if (log.isDebugEnabled()) {
+ log.debug("Exit: {}() with result = {}", joinPoint.getSignature().getName(), result);
+ }
+ return result;
+ } catch (IllegalArgumentException e) {
+ log.error("Illegal argument: {} in {}()", Arrays.toString(joinPoint.getArgs()), joinPoint.getSignature().getName());
+ throw e;
+ }
+ }
+}
diff --git a/NYCEtube/src/main/java/com/nyce/tube/config/ApplicationProperties.java b/NYCEtube/src/main/java/com/nyce/tube/config/ApplicationProperties.java
new file mode 100644
index 000000000..ac8a40615
--- /dev/null
+++ b/NYCEtube/src/main/java/com/nyce/tube/config/ApplicationProperties.java
@@ -0,0 +1,12 @@
+package com.nyce.tube.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Properties specific to NYC Etube.
+ *
+ * Properties are configured in the {@code application.yml} file.
+ * See {@link tech.jhipster.config.JHipsterProperties} for a good example.
+ */
+@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false)
+public class ApplicationProperties {}
diff --git a/NYCEtube/src/main/java/com/nyce/tube/config/AsyncConfiguration.java b/NYCEtube/src/main/java/com/nyce/tube/config/AsyncConfiguration.java
new file mode 100644
index 000000000..cef39960f
--- /dev/null
+++ b/NYCEtube/src/main/java/com/nyce/tube/config/AsyncConfiguration.java
@@ -0,0 +1,46 @@
+package com.nyce.tube.config;
+
+import java.util.concurrent.Executor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
+import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
+import org.springframework.boot.autoconfigure.task.TaskExecutionProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.AsyncConfigurer;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+import tech.jhipster.async.ExceptionHandlingAsyncTaskExecutor;
+
+@Configuration
+@EnableAsync
+@EnableScheduling
+public class AsyncConfiguration implements AsyncConfigurer {
+
+ private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class);
+
+ private final TaskExecutionProperties taskExecutionProperties;
+
+ public AsyncConfiguration(TaskExecutionProperties taskExecutionProperties) {
+ this.taskExecutionProperties = taskExecutionProperties;
+ }
+
+ @Override
+ @Bean(name = "taskExecutor")
+ public Executor getAsyncExecutor() {
+ log.debug("Creating Async Task Executor");
+ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+ executor.setCorePoolSize(taskExecutionProperties.getPool().getCoreSize());
+ executor.setMaxPoolSize(taskExecutionProperties.getPool().getMaxSize());
+ executor.setQueueCapacity(taskExecutionProperties.getPool().getQueueCapacity());
+ executor.setThreadNamePrefix(taskExecutionProperties.getThreadNamePrefix());
+ return new ExceptionHandlingAsyncTaskExecutor(executor);
+ }
+
+ @Override
+ public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
+ return new SimpleAsyncUncaughtExceptionHandler();
+ }
+}
diff --git a/NYCEtube/src/main/java/com/nyce/tube/config/CacheConfiguration.java b/NYCEtube/src/main/java/com/nyce/tube/config/CacheConfiguration.java
new file mode 100644
index 000000000..c164c26aa
--- /dev/null
+++ b/NYCEtube/src/main/java/com/nyce/tube/config/CacheConfiguration.java
@@ -0,0 +1,81 @@
+package com.nyce.tube.config;
+
+import java.time.Duration;
+import org.ehcache.config.builders.*;
+import org.ehcache.jsr107.Eh107Configuration;
+import org.hibernate.cache.jcache.ConfigSettings;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
+import org.springframework.boot.autoconfigure.orm.jpa.HibernatePropertiesCustomizer;
+import org.springframework.boot.info.BuildProperties;
+import org.springframework.boot.info.GitProperties;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.cache.interceptor.KeyGenerator;
+import org.springframework.context.annotation.*;
+import tech.jhipster.config.JHipsterProperties;
+import tech.jhipster.config.cache.PrefixedKeyGenerator;
+
+@Configuration
+@EnableCaching
+public class CacheConfiguration {
+
+ private GitProperties gitProperties;
+ private BuildProperties buildProperties;
+ private final javax.cache.configuration.Configuration