随笔分类 - Java
摘要:@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
阅读全文
摘要:Create you own decreator! Add dependency: <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.9.5</version>
阅读全文
摘要: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
阅读全文
摘要:pom.xml: <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependenc
阅读全文
摘要:Run bash to generate keystore.jks in src/mian/resources folder: keytool -genKey -keyalg RSA -alias linkedin -keystore keystore.jks -storepass password
阅读全文
摘要:Profiles allow us to do different configurations based on different env. application.yml: spring: profiles: dev server: port: 8000 spring: profiles: t
阅读全文
摘要:We can use @Controller to return a view with data: package com.frankmoley.lil.learningspring.web; import com.frankmoley.lil.learningspring.busniess.do
阅读全文
摘要:Controller: @Controller @RequestMapping("/reservations") public class RoomReservationWebController { @Autowired private ReservationService reservation
阅读全文
摘要:First, let's see the code: // builder/Contact.java public class Contact { private String firstName; private String lastName; private String emailAddre
阅读全文
摘要:Coding again the interface. interface: package com.frankmoley.lil.designpatternsapp.factory; public interface Pet { void setName(String name); String
阅读全文
只有注册用户登录后才能阅读该文。
摘要:Previouly we need to define a DAO interface and a DAO impl for 'Employee', it is not so reuseable, since all the DAO has the same structure: Spring da
阅读全文
摘要:pom.xml: The process can be divide into 6 steps: 1. Update db configs in application.properties 2. Create Employee entity 3. Create DAO interface 4. C
阅读全文