Skip to content

Instantly share code, notes, and snippets.

// reference: https://stackoverflow.com/a/34613097/4871489
@RunWith(SpringRunner.class)
// use the exclusive configuration for the test
@SpringBootTest(classes = {CourseApp.class, InstructorResourceIntTest.InstructorResourceTestConfig.class})
public class InstructorResourceIntTest {
// create an exclusive configuration for the test, turning on global security for it
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
protected static class InstructorResourceTestConfig {
@Bean
// reference: https://codingexplained.com/coding/java/spring-framework/return-boolean-value-from-spring-data-jpa-query
@Repository
public interface CompanyRepository extends JpaRepository<Company, Integer> {
@Query("SELECT CASE WHEN COUNT(c) > 0 THEN true ELSE false END FROM Company c WHERE c.name = :companyName")
boolean existsByName(@Param("companyName") String companyName);
}
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'fileIcon'
})
export class FileIconPipe implements PipeTransform {
transform(fileType: string): string {
switch (fileType) {
// images
<!-- main image -->
<div>ImageMain: {{course.imageMain}}</div>
<img *ngIf="imageUrl" [src]="imageUrl"/>
@SpringBootApplication
@EnableConfigurationProperties({ApplicationProperties.class})
public class Application {
// ...
}
<link rel="manifest" href="manifest.webapp" />
<link rel="stylesheet" href="content/css/loading.css">
<!-- jhipster-needle-add-resources-to-root - JHipster will add new resources here -->
<!-- quill style -->
\!h <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
</head>
<body>

More information on Eureka documentation.

Get EurekaClient instance and call the the needed information using the micro-service name.

    @Qualifier("eurekaClient")
    @Autowired
    private EurekaClient eurekaClient;

 public String courseUrl() {
@tinmegali
tinmegali / jh-pagination.md
Last active April 3, 2022 18:35
Manually adding pagination to Angular frontend.

route.ts

Add the following class to file

import {ActivatedRouteSnapshot, Resolve, RouterStateSnapshot, Routes} from '@angular/router';
//...
import {JhiPaginationUtil} from 'ng-jhipster';
import {Injectable} from '@angular/core';

@Injectable()
export class EntityPagingParams implements Resolve<any> {

Creating the image

./gradlew bootRepackage -Pprod buildDocker
  • bootRepackage: Builds an executable archive (WAR) file for the application
  • -Pprod: Specifies the profile to use
  • buildDocker: Builds a docker image based on the Dockerfile present in the src/main/dockerfolder

Running the image

Files in Folder

 var info = new DirectoryInfo(path);
 var fileInfo = info.GetFiles();
 for (file in fileInfo) print (file);