Spring Cloud - 13. Users Microservice Catalog
목차 Spring Cloud - 20. Users Microservice AuthorizationHeaderFilter 추가 Spring Cloud - 19. Users Microservice JWT 생성 Spring Cloud - 18. Users Microservice 로그인 성공 처리 Spring Cloud - 17. Users Microservice Routes 정보 변경 Spring Cloud - 16. Users Microservice loadUserByUsername() 구현 Spring Cloud - 15. Users Microservice AuthenticationFilter Spring Cloud - 14. Users Microservice Order Service Spring Cloud - 13. Users Microservice Catalog Spring Cloud - 12. Users Microservice 사용자 조회 Spring Cloud - 11. Users Microservice Gateway 연동 Spring Cloud - 10. Users Microservice 사용자 추가 Spring Cloud로 개발하는 마이크로서비스 애플리케이션 9 Spring Cloud - Users Microservice 13. Users Microservice Catalog설정 정보server: port: 0spring: application: name: catalog-service h2: console: enabled: true settings: web-allow-others: true datasource: hikari: driver-class-name: org.h2.Driver url: jdbc:h2:mem:testdb username: sa password: jpa: hibernate: ddl-auto: create-drop show-sql: true generate-ddl: trueeureka: client: service-url: defaultZone: http://localhost:8761/eureka#logging:# level:# com.example.catalogservice: DEBUG @Data@Entity@Table(name = "catalog")public class CatalogEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(nullable = false, length = 120, unique = true) private String productId; @Column(nullable = false) private String productName; @Column(nullable = false) private Integer stock; @Column(nullable = false) private Integer unitPrice; @Column(nullable = false, updatable = false, insertable = false) @ColumnDefault(value = "CURRENT_TIMESTAMP") private Date createdAt;} @Repositorypublic interface CatalogRepository extends CrudRepository<CatalogEntity, Long> { CatalogEntity findByProductId(String productId);} public interface CatalogService { Iterable<CatalogEntity> getAllCatalogs();} @Service@Slf4jpublic class CatalogServiceImpl implements CatalogService{ CatalogRepository repository; Environment env; public CatalogServiceImpl(CatalogRepository repository, Environment env){ this.repository = repository; this.env = env; } @Override public Iterable<CatalogEntity> getAllCatalogs() { return repository.findAll(); }}