Closed as not planned
Closed as not planned
Description
SpringBoot version: 3.0.3
OS: Windows 11
Java: OpenJDK 19
Recently I just wrote a simple Spring Boot application.
And I used the latest Spring Boot and the version is 3.0.3.
What I did is I wrote a simple controller, but I found Spring boot can't identify this.
But if I put the simple mapping in startup class, it can work.
The code is simple as below:
package com.example.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class StorageController {
@GetMapping("/hello/hello")
public String hello() {
return "hello";
}
}
The startup class:
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class StorageApplication {
public static void main(String[] args) {
SpringApplication.run(StorageApplication.class, args);
}
@GetMapping("hello")
public String hello() {
return "hello";
}
}
Base on my setting, it should have 2 mapping which is /hello
and /hello/hello
.
Actually, it only can find the first one written in startup class
But it's work in Spring boot 2.7.9