I wrote a rest api using webflux and I used liquebase in this project, but when I sent the project calisdirib request at the end, I saw that the controller did not work. I can't find the problem.
What the problem ? When I query using locahost, it doesn't come here (not working request)
Please help me
My Postman Error
org.springframework.web.server.ResponseStatusException: 404
NOT_FOUND\r\n\tat org.springframework.web.reactive.
resource.ResourceWebHandler.lambda$handle$1(R
esourceWebHandler.java:378)\r\n\tSuppressed:
reactor.core.publisher.FluxOnAssembly$OnAssemblyException: \nError has
been observed at the following site(s):\n\t|_ checkpoint ⇢ HTTP GET
\"/api/label\" [ExceptionHandlingWebHandler]\nStack trace:\r\n\t\tat
org.springframework.web.reactive.resource.ResourceWebHandler.
lambda$handle$1(R
esourceWebHandler.java:378)\r\n\t\tat
reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44)\r\n\t\tat
reactor.core.publisher.Mono.subscribe(Mono.java:4046)\r\n\t\tat
My Controller
@RestController
@RequestMapping("/api/label")//When I query using locahost, it doesn't come here (not working request)
public class LabelController {
@Autowired
LabelService labelService;//this service layer
@GetMapping
public Flux<LabelEntity> getAllLabels(){
return labelService.getAll();
}
}
Main Class
@SpringBootApplication
@EnableR2dbcRepositories
@ComponentScan("com.WebFluxTestCodes.WebFluxTestCodes.business.*")
public class WebFluxTestCodesApplication {
public static void main(String[] args) {
SpringApplication.run(WebFluxTestCodesApplication.class, args);//main class
}
}
pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.WebFluxTestCodes</groupId>
<artifactId>WebFluxTestCodes</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>WebFluxTestCodes</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-r2dbc</artifactId>//r2dbc reactive dependency
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jdbc</artifactId>//jdbc
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>//liquibase database version control
<version>3.10.3</version>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-postgresql</artifactId>//postgre database
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-pool</artifactId>
<version>0.9.0.M1</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>//lombok library anotation getter setter and other
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<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>
</pluginManagement>
</build>