This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.cloud.context.config.annotation.RefreshScope; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.RestController; | |
@RefreshScope | |
@RestController | |
public class WelcomeController | |
{ | |
@Value("${app.service-name}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.cloud.context.config.annotation.RefreshScope; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.RestController; | |
@RefreshScope | |
@RestController | |
public class WelcomeController | |
{ | |
@Value("${app.service-name}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.springbootdev.examples.jpa.examples.dto.response.user.UserResponse; | |
import com.springbootdev.examples.jpa.examples.model.User; | |
import com.springbootdev.examples.jpa.examples.service.UserService; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.data.domain.Page; | |
import org.springframework.data.domain.PageRequest; | |
import org.springframework.data.domain.Pageable; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.PostMapping; | |
import org.springframework.web.bind.annotation.RequestBody; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spring.datasource.url = jdbc:mysql://127.0.0.1:3306/audit_test_db?useSSL=false | |
spring.datasource.username = root | |
spring.datasource.password = root123 | |
## Hibernate Properties | |
# The SQL dialect makes Hibernate generate better SQL for the chosen database | |
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect | |
# Hibernate ddl auto (create, create-drop, validate, update) | |
spring.jpa.hibernate.ddl-auto = update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.data.domain.AuditorAware; | |
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | |
import java.util.Optional; | |
@Configuration | |
@EnableJpaAuditing(auditorAwareRef = "auditorProvider") | |
public class JpaAuditingConfiguration { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.AccessLevel; | |
import lombok.Getter; | |
import lombok.Setter; | |
import org.springframework.data.annotation.CreatedBy; | |
import org.springframework.data.annotation.CreatedDate; | |
import org.springframework.data.annotation.LastModifiedBy; | |
import org.springframework.data.annotation.LastModifiedDate; | |
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | |
import javax.persistence.Column; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.AccessLevel; | |
import lombok.Getter; | |
import lombok.Setter; | |
import javax.persistence.*; | |
@Setter(AccessLevel.PUBLIC) | |
@Getter(AccessLevel.PUBLIC) | |
@Entity | |
@Table(name = "users") | |
public class User extends Auditable<String> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
module.exports = { | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
loader: 'babel-loader', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require("path"); | |
module.exports = { | |
module: { | |
rules: [ | |
{ | |
//only the js and jsx will be considered | |
test: /\.js$/, | |
exclude: /node_modules/, | |
loader: 'babel-loader', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testFindUserById4() { | |
String username = "chathuranga"; | |
String password = "123"; | |
Integer userId = 200; | |
String url = "http://localhost:" + port + "/users/" + userId; | |
HttpHeaders requestHeaders = new HttpHeaders(); |