Skip to content

Instantly share code, notes, and snippets.

View giripilgaonkar's full-sized avatar

Giri Pilgaonkar giripilgaonkar

View GitHub Profile
@jahe
jahe / spring-cheatsheet.java
Last active September 3, 2025 14:33
Spring Cheatsheet
// 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;
}
@jahe
jahe / spring-boot-cheatsheet.java
Last active September 3, 2025 14:31
Spring Boot Cheatsheet
// 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);
}
}
@jahe
jahe / spring-data-cheatsheet.java
Last active January 29, 2021 18:48
Spring Data Cheatsheet
// Find the entity with the latest insert timestamp
@Repository
public interface MyEntityRepo extends JpaRepository<MyEntity, Long> {
MyEntity findFirstByOrderByInsertTimestampDesc();
}