12 2020 档案
摘要:public class Code { public static void main(String[] args) { IntStreams.range(1,4) .forEach(System.out::println); // 1 2 3 Arrays.stream(new int[] {1,
阅读全文
摘要:public class Code { public static void main(String[] args) { Arrays.asList("red", "green", "blue") .stream() .sorted() .findFirst() .ifPresent(System.
阅读全文
摘要:public class Code { public static void main(String[] args) { List<String> names = Arrays.asList("Paul", "Jane", "Sam", "Michaela"); // Way to sort pri
阅读全文
摘要:<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>c
阅读全文
摘要:application-docker.properties: spring.datasource.url=jdbc:mysql://${server}:${port}/explorecali spring.datasource.username=${dbuser} spring.datasource
阅读全文
摘要:application-mysql.properties: spring.datasource.url=jdbc:mysql://ec-mysql:3306/explorecali spring.datasource.username=cali_user spring.datasource.pass
阅读全文
摘要:Before build the docker file, build the jar package: mvn package -DskipTests=true Dockerfile: FROM java:8 WORKDIR / ADD target/explorecali-2.0.0-SNAPS
阅读全文
摘要:Extending, Securing and Dockerizing Spring Boot Microservices Final Product requires External MySql Database. Install Docker For Mac/Windows/Linux ###
阅读全文
摘要:Testing JWT proteceted endpoint: /** * HTTP POST /tours/{tourId}/ratings */ @Test public void createTourRating() throws Exception { restTemplate.excha
阅读全文
摘要:Provider: package com.example.ec.security; import com.example.ec.domain.Role; import io.jsonwebtoken.*; import org.springframework.beans.factory.annot
阅读全文
摘要:If you find yourself filling out the same form over and over again, or working through a weird workflow to enable certain features in your app just to
阅读全文
摘要:require.context: https://webpack.js.org/guides/dependency-management/#requirecontext require.context(directory, useSubdirectories = true, regExp = /^\
阅读全文
摘要:package com.example.ec.security; import com.example.ec.repo.RoleRepository; import org.springframework.beans.factory.annotation.Autowired; import org.
阅读全文
摘要:Controller: @RestController @RequestMapping(path = "/ratings") public class RatingController { private static final Logger LOGGER = LoggerFactory.getL
阅读全文
摘要:Service: package com.example.ec.service; import com.example.ec.domain.Tour; import com.example.ec.domain.TourRating; import com.example.ec.repo.TourRa
阅读全文
摘要:If one request failed, we want to keep database untouched as if the request never happen. Spring makes it easy to add: @Transactional To the method or
阅读全文
摘要:The CSS property object-fit instructs an img to act as the container for its own contents. We can then use the value cover to have the image content b
阅读全文
摘要:Learn how to use the modern CSS property clamp() to create responsive layout sizing that adjusts to the viewport size without the use of media queries
阅读全文
摘要:Apply a grayscale and blurred effect on an image without the use of graphics software by using the CSS filter property. Additionally, use an inset box
阅读全文
摘要:Repo: public interface CourseRepository extends CrudRepository<Course,Integer>{ Optional<Course> findByName(String name); @Query("Select new com.examp
阅读全文
摘要:@Test public void queryByExample() { System.out.println("\nFind the Department with the name 'Humanities' \n" + departmentRepository.findOne(Example.o
阅读全文
摘要:package com.example.university.repo; import com.example.university.domain.Staff; import org.springframework.data.domain.Page; import org.springframewo
阅读全文
摘要:package com.example.university.repo; import com.example.university.domain.Staff; import com.example.university.domain.Student; import com.example.univ
阅读全文
摘要:Entity: package com.example.university.domain; import javax.persistence.*; import java.util.ArrayList; import java.util.List; /** * JPA Entity represe
阅读全文
摘要:New broadcaster: compose: export let combine = (broadcaster1, broadcaster2) => listener => { let value1; let value2; let cancel1 = broadcaster1(value
阅读全文
摘要:All features of CrudRepository plus: void flush(); saveAndFlush() delteInBatch() delteAllInBatch() package com.example.university.repo; import com.exa
阅读全文
摘要:domain/Course.java package com.example.university.domain; import javax.persistence.*; /** * JPA Entity for a Course offered at the University. * <p> *
阅读全文
摘要:@OneToMany: One Student To Many Courses. @JoinTable(name = "Enrollment"): Join Enrollment table. joinColumns: with use "student_id" to link Student an
阅读全文
摘要:Repo: package com.example.ec.repo; import com.example.ec.domain.TourRating; import com.example.ec.domain.TourRatingPk; import org.springframework.data
阅读全文
摘要:package com.example.ec.web; import com.example.ec.domain.Tour; import com.example.ec.domain.TourRating; import com.example.ec.domain.TourRatingPk; imp
阅读全文
摘要:Controller: package com.example.ec.web; import com.example.ec.domain.Tour; import com.example.ec.domain.TourRating; import com.example.ec.domain.TourR
阅读全文
摘要:In software, we come across many use cases when we need to have a composite primary key to define an entry in a table. Composite primary keys are keys
阅读全文
摘要:@RestResource(exported = false): makes the endpoint no longer visible for public. package com.example.ec.repo; import com.example.ec.domain.TourPackag
阅读全文
摘要:package com.example.ec.repo; import com.example.ec.domain.Difficulty; import com.example.ec.domain.Region; import com.example.ec.domain.Tour; import o
阅读全文
摘要:Entity: package com.example.ec.domain; import javax.persistence.*; @Entity public class Tour { @Id @GeneratedValue private Integer id; @Column private
阅读全文
摘要:To build out our word game, we will have to be able to share the word across a few places. This means we have to set up a broadcaster that will push t
阅读全文
摘要:The racing condition would be one possible bug when we apply cache a newtwork request. For example, we implement a search box, for all the requests, w
阅读全文
[Javascript] Broadcaster + Operator + Listener pattern -- 25. Save Network Requests by Using a Cache
摘要:Caches exist to make things faster (at the expense of taking up more memory and possibly outdated results). Our live search is a great use case for im
阅读全文
摘要:Create you own decreator! Add dependency: <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.9.5</version>
阅读全文
摘要:In previous post, we check how to use ifElse to branch out the logic: https://www.cnblogs.com/Answer1215/p/14093562.html let inputToBooks = pipe( wait
阅读全文
摘要:You can do git log first to check which commit message you want to revert to. For example 'xxxxx123' is the commit id we want to revert to. Then do: g
阅读全文
摘要:Dendron is a Visual Studio Code extension that you can download and install free of charge. To download a visual studio code extension, we press Comma
阅读全文
摘要:So far, we've used filter to prevent values when a condition is met. Sometimes you want two different behaviors based on a condition which is where yo
阅读全文
摘要:Besides using Profiles, we can also us Spring Expression Language. package com.frankmoley.lil.fid.config; import com.frankmoley.lil.fid.service.Greeti
阅读全文
摘要:For example, inside code, we want production env & dev env print different time format. @Bean @Profile("!dev") public TimeService timeService(){ retur
阅读全文
摘要:We can have some properties defined inside application.properties or application.yml file. application.properties: app.name=Frank app.greeting=Hello W
阅读全文
摘要:pom.xml: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> SecurityConfigur
阅读全文