This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Return JSON without Jackson mapping classes | |
| @RequestMapping("/users") | |
| public @ResponseBody Map<String, String> getUsers () { | |
| Map<String, String> map = new HashMap<String, String>(); | |
| map.put("user", "Clark Kent"); | |
| return map; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Enable component-scanning and auto-configuration with @SpringBootApplication Annotation | |
| // It combines @Configuration + @ComponentScan + @EnableAutoConfiguration | |
| @SpringBootApplication | |
| public class FooApplication { | |
| public static void main(String[] args) { | |
| // Bootstrap the application | |
| SpringApplication.run(FooApplication.class, args); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Find the entity with the latest insert timestamp | |
| @Repository | |
| public interface MyEntityRepo extends JpaRepository<MyEntity, Long> { | |
| MyEntity findFirstByOrderByInsertTimestampDesc(); | |
| } |