Spring Boot Controller not mapping
I too had the similar issue and was able to finally resolve it by correcting the source package structure following this
Your Controller classes are not scanned by the Component scanning. Your Controller classes must be nested below in package hierarchy to the main SpringApplication class having the main() method, then only it will be scanned and you should also see the RequestMappings listed in the console output while Spring Boot is getting started.
Tested on Spring Boot 1.5.8.RELEASE
But in case you prefer to use your own packaging structure, you can always use the @ComponentScan
annotation to define your basePackages
to scan.
can't mapping the rest controller
Your packages have the wrong structure. You have to put them into your second demo
, where your DemoApplication
is, not the first as you did. Then Spring will recognize them.
Here you can read about the package structuring in Spring Boot.
Related Topics
Check If Url Is Https or Http Protocol
Maven Clean Issue - Non-Resolvable Import Pom - Could Not Transfer Artifact from Nexus
Remove End of Line Characters from Java String
Getting Versioncode and Versionname from Google Play
How to Persist a Property of Type List<String> in Jpa
How to Run Selenium Webdriver in the Background
How to Check If a Java 8 Stream Is Empty
Java Nullpointerexception When Adding to Arraylist
Rsa Decryption Error - Illegalblocksizeexception: Data Must Not Be Longer Than 128 Bytes
Java8 Way to Handle If..Else Check in Collections
How to Indicate to Spring Boot to Use Utc Time Zone for Date Parameters
How to Check Hikaricp Connection Pooling Is Working or Not in Java
Checking If a String Contains a Dot
Javac: File Not Found: First.Java Usage: Javac <Options> <Source Files>
Spring - Read Property Value from Properties File in Static Field of Class
Spring-Data-Jpa Repository - Underscore on Entity Column Name