[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"global-header-tutorials-static":3,"article-spring-framework-project-for-gradle-with-intellij-idea":4,"initial-similar-fetch":24},[],{"alias":5,"title":6,"description":7,"content":8,"thumbnail":9,"keywords":10,"categories":20,"tags":22,"createdAt":23},"spring-framework-project-for-gradle-with-intellij-idea","How to create a clean Spring Framework project for Gradle with IntelliJ IDEA","Create a clean Spring Framework project for Gradle with IntelliJ IDEA","{\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"In this tutorial, we are going to set up a clean Spring framework project with Gradle and IntelliJ IDEA. Here we are not using Spring Boot initializer.\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":2},\"content\":[{\"type\":\"text\",\"text\":\"Project Setup with IntelliJ IDEA\"}]},{\"type\":\"image\",\"attrs\":{\"src\":\"https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F0e4abad5-17e2-4311-8cf0-7d8f67af975a_spring-framework.png\",\"alt\":null,\"title\":null,\"width\":null,\"height\":null}},{\"type\":\"bulletList\",\"content\":[{\"type\":\"listItem\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Launch IntelliJ IDEA, click New Project (or go to File > New > Project)\"}]}]},{\"type\":\"listItem\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"On the left side, select Java, give the project name(csbyte), and choose the location to save the project\"}]}]},{\"type\":\"listItem\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Select Groovy as Gradle DSL\"}]}]},{\"type\":\"listItem\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Select the latest Gradle version. Here, we are using the default 8.5 Gradle version. Although we need Gradle 9, there might be some issues doing so; we will discuss it later.\"}]}]},{\"type\":\"listItem\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Give the groupId and ArtifactId, and create the project\"}]}]}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"The project Structure will look like this:\"}]},{\"type\":\"image\",\"attrs\":{\"src\":\"https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F90f7c923-ee1c-485b-9c88-0c7a16dcdd01_project_structure.png\",\"alt\":null,\"title\":null,\"width\":null,\"height\":null}},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"As discussed previously, we will get the following error:\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"Unsupported class file major version 69\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"This is due to the incompatibility of the Gradle version used for JDK 25.\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"One way to do it is to use the required Gradle version inside \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"gradle-wrapper.properties\"},{\"type\":\"text\",\"text\":\" file.\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"distributionUrl=https\\\\:\u002F\u002Fservices.gradle.org\u002Fdistributions\u002Fgradle-9.1-bin.zip\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Using this in the properties file, we can get the following error. This is due to a compatibility mismatch between the Gradle 9.x version and the way IntelliJ IDEA injects temporary run scripts behind the scenes.\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Error:\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"Initialization script '\u002Ftmp\u002FMain_main__1.gradle' line: 27\\n\\n* What went wrong:\\nA problem occurred configuring root project 'spring-tutorial'.\\n> Could not get unknown property 'convention' for root project 'spring-tutorial' of type org.gradle.api.Project.\\n\\n* Try:\\n> Run with --stacktrace option to get the stack trace.\\n> Run with --info or --debug option to get more log output.\\n> Run with --scan to get full insights from a Build Scan (powered by Develocity).\\n> Get more help at https:\u002F\u002Fhelp.gradle.org.\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"So, we will not use this setup; leave Gradle 8 as it is.\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Update build.gradle with a Toolchain\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"In order to fix this issue, inside \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"build.gradle\"},{\"type\":\"text\",\"text\":\" the  file, add the toolchain for the Java version. This will force Gradle to use JDK 25 for the compiler.\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"java {\\n    toolchain {\\n        languageVersion = JavaLanguageVersion.of(25)\\n    }\\n} \"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Update the wrapper properties\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Use the following Gradle version in \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"gradle-wrapper.properties\"},{\"type\":\"text\",\"text\":\" \"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"distributionUrl=https\\\\:\u002F\u002Fservices.gradle.org\u002Fdistributions\u002Fgradle-8.14.4-bin.zip\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"This will fix the issues.\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":2},\"content\":[{\"type\":\"text\",\"text\":\"Create Spring Framework Project\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Add dependencies\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Now, let's create the project for this, update the \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"build.gradle\"},{\"type\":\"text\",\"text\":\" file with the following dependencies\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\" \u002F\u002F Import Spring Framework BOM to align core versions\\n    implementation platform(\\\"org.springframework:spring-framework-bom:7.0.7\\\")\\n    \\n    implementation 'org.springframework:spring-context'\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"The use of \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"spring-framework-bom\"},{\"type\":\"text\",\"text\":\" dependency is that you don't explicitly need to define the versions for sub dependencies like spring-context, beans etc, we are using Spring Framework 7, so we use the \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"spring-framework-bom\"},{\"type\":\"text\",\"text\":\" 7\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"spring-context\"},{\"type\":\"text\",\"text\":\" is a core container dependency which includes  beans, core, aop,  expression, etc.\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Create a sample example\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Let's create a sample example to test the setup. \"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Create a service class\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"java\"},\"content\":[{\"type\":\"text\",\"text\":\"package org.csbyte.sample;\\n\\nimport org.springframework.stereotype.Service;\\n\\n@Service\\npublic class MyService {\\n    public String getGreeting() {\\n        return \\\"Hello from pure Spring Framework!\\\";\\n    }\\n}\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Create the config class to set \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"componentScan\"},{\"type\":\"text\",\"text\":\" \"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"java\"},\"content\":[{\"type\":\"text\",\"text\":\"package org.csbyte.sample;\\n\\nimport org.springframework.context.annotation.ComponentScan;\\nimport org.springframework.context.annotation.Configuration;\\n\\n@Configuration\\n@ComponentScan(basePackages = \\\"org.csbyte\\\")\\npublic class AppConfig {\\n}\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Add your own base package.\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Now, update the main entry point.\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"java\"},\"content\":[{\"type\":\"text\",\"text\":\"package org.csbyte;\\n\\nimport org.csbyte.sample.AppConfig;\\nimport org.csbyte.sample.MyService;\\nimport org.springframework.context.annotation.AnnotationConfigApplicationContext;\\n\\npublic class Main {\\n    public static void main(String[] args) {\\n        System.out.println(\\\"Hello world!\\\");\\n        try (AnnotationConfigApplicationContext context =\\n                     new AnnotationConfigApplicationContext(AppConfig.class)) {\\n\\n            \u002F\u002F Retrieve a managed bean from the context\\n            MyService service = context.getBean(MyService.class);\\n\\n            \u002F\u002F Use it\\n            System.out.println(service.getGreeting());\\n        } \u002F\u002F The try-with-resources block safely closes the context here\\n    }\\n} \"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Now, run the application\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Output:\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"> Task :Main.main()\\nHello world!\\nHello from pure Spring Framework!\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"This is how we can set up the clean Spring Framework project. This is useful for learning the core concept of Spring Framework and also designing the parent microservice build.\"}]}]}","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F0e4abad5-17e2-4311-8cf0-7d8f67af975a_spring-framework.png",[11,12,13,14,15,16,17,18,19],"spring","programming","coding","gradle","intellij","spring-boot-4","java","spring-framework-7","spring-boot",[21],"Spring Framework",[11,19],"2026-05-19T10:28:20.866Z",[25,32,38,44,50,56,62,68,74,80,85,91,97],{"alias":26,"title":27,"description":28,"thumbnail":29,"createdAt":30,"tutorialAlias":31,"lessonAlias":31},"springdoc-openapi-swagger-ui-in-spring","Implementing springdoc-openapi swagger ui in Spring Boot application","Adding springdoc-openapi swagger ui in a Spring Boot application","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F3501ace5-c9b0-4819-8d35-d8714390c075_swagger_product_highlighted.png","2026-06-30T10:39:32.703Z",null,{"alias":33,"title":34,"description":35,"thumbnail":36,"createdAt":37,"tutorialAlias":31,"lessonAlias":31},"spring-boot-multi-stage-build-with-docker","Creating spring boot multi-stage build with docker","How to create a Spring Boot multi-stage build with Docker","\u002Fuploads\u002Fthumbnails\u002F8931e2f7-a669-4fbb-855b-5ebe396f462e_multi-stage-build-docke.jpeg","2026-06-20T06:34:41.356Z",{"alias":39,"title":40,"description":41,"thumbnail":42,"createdAt":43,"tutorialAlias":31,"lessonAlias":31},"configure-profile-in-spring-boot","Configure different spring profiles in spring boot application","Managing Spring Boot profiles for different environments along with Docker","\u002Fuploads\u002Fthumbnails\u002F59a52e59-4b56-469d-8902-41af5e0f13dd_Spring-profil.jpeg","2026-06-20T04:51:27.098Z",{"alias":45,"title":46,"description":47,"thumbnail":48,"createdAt":49,"tutorialAlias":31,"lessonAlias":31},"global-exception-handling-in-spring-boot","Implementing Robust Global Exception Handling in Spring Boot","How to Handle Errors in Spring Boot: An Architectural Guide","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F554489e1-d142-4ea5-a393-994a13d7b113_exception-handling.png","2026-06-12T17:15:16.253Z",{"alias":51,"title":52,"description":53,"thumbnail":54,"createdAt":55,"tutorialAlias":31,"lessonAlias":31},"spring-boot-create-libraries-gradle","Building Reusable Spring Boot Libraries with Gradle","Architectural Guide: Building Reusable Spring Boot Libraries with Gradle","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002Ff4fb088d-1018-4d2b-ae6c-cdd5d0fd60ae_spring-Initializr.png","2026-06-12T15:55:20.994Z",{"alias":57,"title":58,"description":59,"thumbnail":60,"createdAt":61,"tutorialAlias":31,"lessonAlias":31},"multi-build-project-gradle-spring-boot","Setting up a multi-project build in Gradle for Spring Boot","How to set up a multi-project build in Gradle for Spring Boot","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002Fd43933e4-a7a3-404b-a300-8f02db98f549_multi-build-project.png","2026-06-12T04:15:23.045Z",{"alias":63,"title":64,"description":65,"thumbnail":66,"createdAt":67,"tutorialAlias":31,"lessonAlias":31},"java-version-mismatch-gradle","Java Version Mismatch for Gradle Build","How to Fix Gradle Error: Dependency requires at least JVM runtime version 17. This build uses a Java 8 JVM","\u002Fuploads\u002Fthumbnails\u002Fa4c6c910-5623-4db9-93f5-a515135adb99_gradle_version_mismatc.jpeg","2026-06-09T12:15:21.729Z",{"alias":69,"title":70,"description":71,"thumbnail":72,"createdAt":73,"tutorialAlias":31,"lessonAlias":31},"constructor-confusion-in-spring","Constructor Confusion in Spring Framework","Constructor Confusion and how to handle it in Spring Framework","\u002Fuploads\u002Fthumbnails\u002Fd0f09fc0-e1f9-49d1-bf9a-7d1c41050196_di_confusio.jpeg","2026-05-21T14:13:31.437Z",{"alias":75,"title":76,"description":77,"thumbnail":78,"createdAt":79,"tutorialAlias":31,"lessonAlias":31},"dependency-pull-lookup-spring","Dependency Pull and Contextualized Dependency Lookup in Spring Framework","Dependency Pull and Contextualized Dependency Lookup IoC Types in Spring Framework","\u002Fuploads\u002Fthumbnails\u002Fd1132443-313b-4dce-b713-55f356ef6051_depndency_pull.png","2026-05-20T15:26:06.494Z",{"alias":81,"title":82,"description":82,"thumbnail":83,"createdAt":84,"tutorialAlias":31,"lessonAlias":31},"types-of-dependency-injection-spring","Types of Dependency Injection in Spring Framework","\u002Fuploads\u002Fthumbnails\u002Fafb32399-6dda-41c4-b07c-7decb8257bbb_di_constructor_sette.jpeg","2026-05-19T17:01:51.972Z",{"alias":86,"title":87,"description":88,"thumbnail":89,"createdAt":90,"tutorialAlias":31,"lessonAlias":31},"spring-dependency-injection-and-inversion-control","Dependency Injection (DI) and Inversion of Control (IoC) in Spring","Mastering Dependency Injection (DI) and Inversion of Control (IoC) in Spring: A Practical Guide for Building a Notification System","\u002Fuploads\u002Fthumbnails\u002F53c64b94-f188-40b4-9ae9-ad97612d688b_spring_d.jpeg","2026-05-19T05:31:45.138Z",{"alias":92,"title":93,"description":94,"thumbnail":95,"createdAt":96,"tutorialAlias":31,"lessonAlias":31},"setting-nginx-ssl-for-spring-boot-application","Setup Nginx and SSL for Spring Boot Application","Setting Nginx as a reverse proxy in our Spring Boot application","\u002Fuploads\u002Fthumbnails\u002F5433c987-9e86-4d90-9cce-a831d1598ba4_spring-boot-nginx.png","2026-05-04T05:36:23.075Z",{"alias":98,"title":99,"description":100,"thumbnail":101,"createdAt":102,"tutorialAlias":31,"lessonAlias":31},"deploy-spring-boot-application-with-docker","Deploy Spring Boot Application with Docker on Ubuntu Server","The ultimate guide to deploying our Spring Boot application with Docker on an Ubuntu server","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F55a11844-d1e9-4e83-80e5-c6bb6df7d58b_intellij-idea-build.png","2026-05-03T05:58:55.642Z"]