northwind/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>anilacar</groupId>
<artifactId>northwind</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>northwind</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>19.0.1</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Product.java
package anilacar.northwind.entities.concretes;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
@Data
@Entity
@Table(name = "products")
public class Product {
@Id //işlemleri primary keye göre yapar @Id olarak belirtmeliyiz
@GeneratedValue //sıralama işlemi için numaraları
@Column(name="product_id")
private int id ;
@Column(name="category_id")
private int categoryId;
@Column(name="product_name")
private String productName;
@Column(name="unit_price")
private double unitPrice ;
@Column(name="unit_in_stock")
private Integer unitsInStock;
@Column(name="quantity_per_unit")
private String quantityPerUnit;
public Product() {
}
public Product(int id, int categoryId, String productName, double unitPrice, Integer unitsInStock,
String quantityPerUnit) {
super();
this.id = id;
this.categoryId = categoryId;
this.productName = productName;
this.unitPrice = unitPrice;
this.unitsInStock = unitsInStock;
this.quantityPerUnit = quantityPerUnit;
}
}
ProductDao.java
package anilacar.northwind.dataAccess.abstracts;
import org.springframework.data.jpa.repository.JpaRepository;
import anilacar.northwind.entities.concretes.Product;
public interface ProductDao extends JpaRepository<Product, Integer>{
}
ProductsController.java
ProductManager.java
package anilacar.northwind.business.concretes;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import anilacar.northwind.business.abstracts.ProductService;
import anilacar.northwind.dataAccess.abstracts.ProductDao;
import anilacar.northwind.entities.concretes.Product;
@Service
public class ProductManager implements ProductService {
private ProductDao productDao;
@Autowired
public ProductManager(ProductDao productDao) {
super();
this.productDao = productDao;
}
@Override
public List<Product> getAll() {
return this.productDao.findAll();
}
}
ProductsController.java
package anilacar.northwind.api.controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import anilacar.northwind.business.abstracts.ProductService;
import anilacar.northwind.entities.concretes.Product;
@RestController
@RequestMapping("api/products")
public class ProductsController {
private ProductService productService;
@Autowired
public ProductsController(ProductService productService) {
super();
this.productService = productService;
}
@GetMapping("/getall")
public List<Product> getAll(){
return this.productService.getAll();
}
}
How can ı fix this problem . Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException: Cannot invoke "org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()" because "this.condition" is null .