{"id":71214,"date":"2019-05-13T15:00:00","date_gmt":"2019-05-13T12:00:00","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=71214"},"modified":"2019-05-11T21:50:35","modified_gmt":"2019-05-11T18:50:35","slug":"spring-netbeans-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/","title":{"rendered":"Spring Netbeans Example"},"content":{"rendered":"<h2 class=\"wp-block-heading\">1. Introduction<\/h2>\n<p>In this post, we feature a comprehensive article on Spring Netbeans. Java Spring has been a popular Java development framework in use for over 10 years now. Getting started with Java Spring development has got quite easier over the years. However, it sometimes is challenging to get started with Java Spring using IDEs. <\/p>\n<p>Netbeans is one such popular IDE that is being used in industries around the world. In this article, I take you through the process of using Netbeans IDE for developing a Spring application. We start with a normal Spring Core application and move towards developing a Spring Web MVC based application using the IDE. This tutorial takes you through detailed steps that you need to do for the same. <\/p>\n<\/p>\n<h2 class=\"wp-block-heading\">2. Prerequisities<\/h2>\n<p>Before we begin, there are certain pre-requisites that you need to setup before we progress on the example. We are going to use the below tools and technologies for the example: <\/p>\n<ul class=\"wp-block-list\">\n<li>Netbeans 8.2 IDE<\/li>\n<li>Java JDK 7\/8<\/li>\n<li>Glassfish Server<\/li>\n<\/ul>\n<p>Once you have the above items installed, proceed to the next step.<\/p>\n<h2 class=\"wp-block-heading\">3. Creating the project<\/h2>\n<p>To create the project, go to the File menu and select New Project. It opens up a New Project panel as shown below. Select the project category &#8211; Java Web and Project type as Web application to begin with. <\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/1.jpeg\" alt=\"Spring Netbeans - Create the project\" class=\"wp-image-71710\"\/><figcaption> Create the project <\/figcaption><\/figure>\n<p>Enter the project name and select the path to store your project as shown in the below image and click Next<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/2.jpeg\" alt=\"Spring Netbeans - project name \" class=\"wp-image-71711\"\/><figcaption> Enter the project name <\/figcaption><\/figure>\n<p> In the next screen, select your server to be Glassfish server and Java version to be Java EE 7 or Java EE 8. The Context path can be kept as it is. The context path decides your local URL path. <\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/4.jpeg\" alt=\"Spring Netbeans - Select Server\" class=\"wp-image-71712\"\/><figcaption>Select Server<\/figcaption><\/figure>\n<p>In the final screen, you should see the selection of framework. Netbeans support various frameworks starter projects out of the box. Spring Framework is one of them. In the frameworks selection screen, select Java Spring Framework. You can choose the latest version here. As of present day, we have Spring 4.0.1 version available out of the box in Netbeans. Choose the version and click finish to create the initial project. It might take some time if the framework was not downloaded before.  <\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/3.jpeg\" alt=\"Spring Netbeans - Spring Web MVC\" class=\"wp-image-71713\"\/><figcaption>Choosing Spring Web MVC framework<\/figcaption><\/figure>\n<h2 class=\"wp-block-heading\">4. Run your project first time<\/h2>\n<p>Now that you have created the first Spring Web MVC project, let us run it. To run the project, run project option in the image shown below. The option will perform two operations. <\/p>\n<ol class=\"wp-block-list\">\n<li>It will build the Spring Web MVC project and validate it for any sort of errors<\/li>\n<li>It will deploy and start your web MVC application on Glassfish server.<\/li>\n<\/ol>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/5.jpeg\" alt=\"Spring Netbeans - Running the project\" class=\"wp-image-71714\"\/><figcaption>Running the project<\/figcaption><\/figure>\n<p>The Glassfish server will automatically open the home page. The default page will contain simple text mentioning that it is a default page and guide you through how to make changes.<\/p>\n<h2 class=\"wp-block-heading\"> 5. Understanding the project structure<\/h2>\n<p>The project created by Netbeans shows four main folders in the projects window. The folders are:<\/p>\n<ul class=\"wp-block-list\">\n<li>Web Pages<\/li>\n<li>Source Packages <\/li>\n<li>Libraries<\/li>\n<li>Configuration Files<\/li>\n<\/ul>\n<p>This organized folder structure of Netbeans is a great benefit. It is self explanatory as to which files are contained in the folders. A brief description of each of the folders is discussed below.<\/p>\n<p>The web pages folder contain the WEB-INF directory which holds the web related configuration files and the jsp files which are to be served to the user. The Source packages is the place where all your Spring Controllers, Beans and related java files will be placed. The Libraries folder is the collection of all the dependencies. It contains the jar files of the relevant libraries that are required for the Spring Web MVC application. Any additional library that you use can be added to libraries folder. The last is Configuration Files contain the configuration files for the Spring Web MVC application. This includes web.xml again as it is also a configuration file for the Web servlet configuration. <\/p>\n<h2 class=\"wp-block-heading\"> 6. Creating a project from scratch<\/h2>\n<p>You might not always require a Web MVC project and might be looking to create a project from scratch with only the required dependencies. In order to do so, we need to manually create either a Dynamic Web project or a Java project depending on the type of project we need. Later, we need to add the Spring dependencies to it. Let us go through the process of creating the same. <\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/6.jpeg\" alt=\"Spring Netbeans - Spring Core App\" class=\"wp-image-71715\"\/><figcaption>Creating Spring Core App<\/figcaption><\/figure>\n<p>We will go through the process of creating a Spring Core project. To create one, navigate to New Project. Select Java Application as the type of project and click next. Name the project as SpringCoreApp. <div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/7.jpeg\" alt=\"Spring Netbeans - Configuring Project\" class=\"wp-image-71716\"\/><figcaption>Configuring Project<\/figcaption><\/figure>\n<p>You will see a simple project created with just two folders &#8211; Source packages and Libraries. <\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"427\" height=\"364\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/8.jpeg\" alt=\"Spring Netbeans - Directory Structure\" class=\"wp-image-71717\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/8.jpeg 427w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/8-300x256.jpeg 300w\" sizes=\"(max-width: 427px) 100vw, 427px\" \/><figcaption>Directory Structure &#8211; Java Application<\/figcaption><\/figure>\n<p>The first step towards configuring a Spring Core project is to add its libraries. You can download the <a href=\"https:\/\/mvnrepository.com\/artifact\/org.springframework\/spring-core\/3.1.1.RELEASE\">Spring Core<\/a> and <a href=\"https:\/\/mvnrepository.com\/artifact\/org.springframework\/spring-context\/3.0.2.RELEASE\">Spring Context<\/a> jar files from the links and save them. To add the jars to the libraries, right click the project and select project properties. <\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/9.jpeg\" alt=\"Spring Netbeans - Adding Libraries\" class=\"wp-image-71718\"\/><figcaption>Adding Libraries to Spring Core App<\/figcaption><\/figure>\n<p>In the project properties select Libraries as shown in the image above. Click Add jar and select the jars that you have downloaded and click OK. You should see the files in libraries section now. You now have the base dependencies for the Spring project. Let us begin creating the configuration file and a basic bean to start our project. <\/p>\n<h3 class=\"wp-block-heading\">6.1. Configuring Spring Application<\/h3>\n<p>In this tutorial, we will be using the Java based Spring framework configuration to create our Spring Core Application. To start with the same, we first need to create a Spring Bean. The Spring bean with Java configuration can be created by just annotating it with <code>@Bean<\/code> annotation in the configuration file<\/p>\n<p>Let us create our first bean.<\/p>\n<p><span style=\"text-decoration: underline\"><em>HelloJava.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package springcoreapp;\n\n\/**\n *\n * @author abhishekkothari\n *\/\npublic class HelloJava {\n   private String tutorName;\n\n    public String getTutorName() {\n        return tutorName;\n    }\n\n    public void setTutorName(String tutorName) {\n        this.tutorName = tutorName;\n    }\n\n}\n\n<\/pre>\n<p>The above file provides a class which has an attribute in it. Now let us configure Spring to provide this as a bean. To create the Spring configuration file, use the below code. <\/p>\n<p><span style=\"text-decoration: underline\"><em>HelloSpringConfig.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package springcoreapp;\n\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\n\n\/**\n *\n * @author abhishekkothari\n *\/\n@Configuration\npublic class HelloSpringConfig {\n    @Bean\n    public HelloJava helloJava(){\n        return new HelloJava();\n    }\n}\n<\/pre>\n<p>Notice two annotations in the above code. These annotations are the primary annotations for the Java configuration in Spring Core application. The annotation <code>@Configuration<\/code> signifies that the class needs to be treated as a Spring configuration class. The <code>@Bean<\/code> annotation signifies that the function provides a bean. This configuration is quite manual in that we need to define the functions for each bean. In the present release of Spring, it also allows you to mark the beans as autowired to get eliminate the need for these functions. Now that we have one bean and the configuration file in place, let us run the project and see the bean in action<\/p>\n<p>To start the project, we need to update the main function in the class &lt;code&gt;SpringCoreApp&lt;\/code&gt; that was created by default. In case you gave a different name to the project, the class might differ. Update the class to contain the below code. <\/p>\n<p><span style=\"text-decoration: underline\"><em>SpringCoreApp.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package springcoreapp;\n\nimport org.springframework.context.annotation.AnnotationConfigApplicationContext;\n\n\/**\n *\n * @author abhishekkothari\n *\/\npublic class SpringCoreApp {\n\n    \/**\n     * @param args the command line arguments\n     *\/\n    public static void main(String[] args) {\n        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(HelloSpringConfig.class);\n\n        HelloJava hellojava = ctx.getBean(HelloJava.class);\n        hellojava.setTutorName(\"Abhishek Kothari!\");\n        hellojava.getTutorName();\n    }\n}\n<\/pre>\n<p>The above code does the job of starting the Spring application and load its configuration files. Let us understand the <code>main<\/code> function code line by line. The first line in the function loads the application configuration using the annotation based configuration feature. The class specifies a single configuration file that we had created and uses that to pass the configuration to the Spring Framework. There might be a need to have multiple configuration files which we will cover later in the tutorial. The next line of code tries to get the bean using the annotation context object that was created before. This method tries to lookup the function with the <code>@Bean<\/code> annotation returning the class object that is passed as the argument in the function. This means that if we have passed <code>HelloJava.class<\/code>, it will look up for a function with return type <code>HelloJava<\/code>. You must have noticed this function in the configuration file that we created above. The further code in the function is simple object operations. To get an actual output in the code, let us add a print statement as well. The code will look like the one shown below.[ulp id=&#8217;7POIYxRf1FUtPpmL&#8217;]<\/p>\n<p><span style=\"text-decoration: underline\"><em>SpringCoreApp.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package springcoreapp;\n\nimport org.springframework.context.annotation.AnnotationConfigApplicationContext;\n\n\/**\n *\n * @author abhishekkothari\n *\/\npublic class SpringCoreApp {\n\n    \/**\n     * @param args the command line arguments\n     *\/\n    public static void main(String[] args) {\n        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(HelloSpringConfig.class);\n\n        HelloJava hellojava = ctx.getBean(HelloJava.class);\n        hellojava.setTutorName(\"Abhishek Kothari!\");\n        System.out.println(hellojava.getTutorName());\n    }\n}\n<\/pre>\n<h3 class=\"wp-block-heading\">6.2 Running the Spring Core App<\/h3>\n<p>Now that we have all the things in place, let us actually execute the code and see the output. As soon as you run the code, you will hit a roadblock with the below error. <\/p>\n<pre class=\"brush:bash\">run:\nException in thread \"main\" java.lang.NoClassDefFoundError: org\/springframework\/beans\/factory\/support\/BeanDefinitionRegistry\n\tat java.lang.ClassLoader.defineClass1(Native Method)\n\tat java.lang.ClassLoader.defineClass(ClassLoader.java:763)\n\tat java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)\n\tat java.net.URLClassLoader.defineClass(URLClassLoader.java:467)\n\tat java.net.URLClassLoader.access$100(URLClassLoader.java:73)\n\tat java.net.URLClassLoader$1.run(URLClassLoader.java:368)\n\tat java.net.URLClassLoader$1.run(URLClassLoader.java:362)\n\tat java.security.AccessController.doPrivileged(Native Method)\n\tat java.net.URLClassLoader.findClass(URLClassLoader.java:361)\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:424)\n\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:357)\n\tat java.lang.ClassLoader.defineClass1(Native Method)\n\tat java.lang.ClassLoader.defineClass(ClassLoader.java:763)\n\tat java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)\n\tat java.net.URLClassLoader.defineClass(URLClassLoader.java:467)\n\tat java.net.URLClassLoader.access$100(URLClassLoader.java:73)\n\tat java.net.URLClassLoader$1.run(URLClassLoader.java:368)\n\tat java.net.URLClassLoader$1.run(URLClassLoader.java:362)\n\tat java.security.AccessController.doPrivileged(Native Method)\n\tat java.net.URLClassLoader.findClass(URLClassLoader.java:361)\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:424)\n\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:357)\n\tat springcoreapp.SpringCoreApp.main(SpringCoreApp.java:20)\nCaused by: java.lang.ClassNotFoundException: org.springframework.beans.factory.support.BeanDefinitionRegistry\n\tat java.net.URLClassLoader.findClass(URLClassLoader.java:381)\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:424)\n\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:357)\n\t... 25 more\n\/Users\/abhishekkothari\/Library\/Caches\/NetBeans\/8.2\/executor-snippets\/run.xml:53: Java returned: 1\nBUILD FAILED (total time: 1 second)\n\n<\/pre>\n<p>Although there was no failures in compilation, it gave this error. The reason behind the error is that in the background spring is dependent on other jars too which need to be added. Spring is a modularised framework and we need to put together all the dependent modules to get it to work. Download the <a href=\"http:\/\/www.java2s.com\/Code\/Jar\/o\/Downloadorgapachecommonsloggingjar.htm\">Apache Commons Loggging<\/a> jar and all the Spring framework dependencies from this <a href=\"http:\/\/maven.springframework.org\/release\/org\/springframework\/spring\/5.1.7.RELEASE\/\">link.<\/a> Download the dist archive. From the dist archive, add all the release jars into the dependencies for the project. Once that is done, run the project. You should not see any error. The output of the project should be similar to the one shown below.<\/p>\n<pre class=\"brush:bash\">run:\nAbhishek Kothari!\nBUILD SUCCESSFUL (total time: 1 second)\n<\/pre>\n<p>The application runs perfectly alright and is able to get the bean and use it. There are chances where you might need to use multiple configuration files. Let us discuss the same in the next section. <\/p>\n<h2 class=\"wp-block-heading\">7. Using multiple configuration files<\/h2>\n<p>Before understanding how to use multiple configuration files, let us create another bean and another configuration file. The code for the files is given below.<\/p>\n<p><span style=\"text-decoration: underline\"><em>HelloSecondTime.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package springcoreapp;\n\n\/**\n *\n * @author abhishekkothari\n *\/\npublic class HelloSecondTime {\n   private String studentName;\n\n    public String getStudentName() {\n        return studentName;\n    }\n\n    public void setStudentName(String studentName) {\n        this.studentName = studentName;\n    }\n\n}\n\n<\/pre>\n<p><span style=\"text-decoration: underline\"><em>HelloSecondConfig.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package springcoreapp;\n\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\n\n\/**\n *\n * @author abhishekkothari\n *\/\n@Configuration\npublic class HelloSecondConfig {\n    @Bean\n    public HelloSecondTime helloSecondTime(){\n        return new HelloSecondTime();\n    }\n}\n<\/pre>\n<p>Now that we have two configuration files configuring different beans, we can modify our code in the main function to utilise these two configuration files. To do so, update the code inside the function as shown below.<\/p>\n<p><span style=\"text-decoration: underline\"><em>SpringCoreApp.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package springcoreapp;\n\nimport org.springframework.context.annotation.AnnotationConfigApplicationContext;\n\n\/**\n *\n * @author abhishekkothari\n *\/\npublic class SpringCoreApp {\n\n    \/**\n     * @param args the command line arguments\n     *\/\n    public static void main(String[] args) {\n        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();\n        ctx.register(HelloSpringConfig.class);\n        ctx.register(HelloSecondConfig.class);\n        ctx.refresh();\n        HelloJava hellojava = ctx.getBean(HelloJava.class);\n        hellojava.setTutorName(\"Abhishek Kothari!\");\n        System.out.println(hellojava.getTutorName());\n        \n        HelloSecondTime helloSecondTime = ctx.getBean(HelloSecondTime.class);\n        helloSecondTime.setStudentName(\"You!\");\n        System.out.println(helloSecondTime.getStudentName());\n    }\n    \n}\n\n<\/pre>\n<p>Execute the code with the two configuration files registered in the main function. The code should now be able to read the two configuration files and progress on the same. On executing the code, you should be seeing an output similar to the one shown below. <\/p>\n<p>run:<br \/> Abhishek Kothari!<br \/> You!<br \/> BUILD SUCCESSFUL (total time: 2 seconds)<\/p>\n<p>Thus, we built a spring core application using multiple configuration file and having multiple beans. <\/p>\n<h2 class=\"wp-block-heading\">8. Spring Netbeans &#8211; Conclusion<\/h2>\n<p>Building a Spring App using Netbeans is quite easy as long as you understand the basic about the Spring framework. In this tutorial, we captured the process of building a Spring Web MVC app as well as Spring Core application from scratch. Further coding can easily be done on top of these just like any other Spring application. The code or imports might change with the future versions of Spring framework. Hence, you need to ensure that you are using the right version of Spring framework at any point of time. <\/p>\n<h2 class=\"wp-block-heading\"> 9. Download<\/h2>\n<p>The code files of the project created above are packaged in an archive and provided at the below link.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2019\/05\/SpringCoreApp.zip\"><strong>Spring Netbeans Example<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction In this post, we feature a comprehensive article on Spring Netbeans. Java Spring has been a popular Java development framework in use for over 10 years now. Getting started with Java Spring development has got quite easier over the years. However, it sometimes is challenging to get started with Java Spring using IDEs. &hellip;<\/p>\n","protected":false},"author":152,"featured_media":1248,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[52],"tags":[563],"class_list":["post-71214","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring","tag-netbeans"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spring Netbeans Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn more about Spring? Then check out our detailed example on Spring Netbeans!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Netbeans Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn more about Spring? Then check out our detailed example on Spring Netbeans!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2019-05-13T12:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Abhishek Kothari\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Abhishek Kothari\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/\"},\"author\":{\"name\":\"Abhishek Kothari\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/824bb183aec8b131998976063d2926ef\"},\"headline\":\"Spring Netbeans Example\",\"datePublished\":\"2019-05-13T12:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/\"},\"wordCount\":1811,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg\",\"keywords\":[\"Netbeans\"],\"articleSection\":[\"spring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/\",\"name\":\"Spring Netbeans Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg\",\"datePublished\":\"2019-05-13T12:00:00+00:00\",\"description\":\"Interested to learn more about Spring? Then check out our detailed example on Spring Netbeans!\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"spring\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/spring\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Spring Netbeans Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/824bb183aec8b131998976063d2926ef\",\"name\":\"Abhishek Kothari\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0330027588516ca573c97a060605ee7e7b99fc40fd0037cf8d1bf5166b4e4bd6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0330027588516ca573c97a060605ee7e7b99fc40fd0037cf8d1bf5166b4e4bd6?s=96&d=mm&r=g\",\"caption\":\"Abhishek Kothari\"},\"description\":\"Abhishek is a Web Developer with diverse skills across multiple Web development technologies. During his professional career, he has worked on numerous enterprise level applications and understood the technological architecture and complexities involved in making an exceptional project. His passion to share knowledge among the community through various mediums has led him towards being a Professional Online Trainer, Youtuber as well as Technical Content Writer.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/abhishek-kothari\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Netbeans Example - Java Code Geeks","description":"Interested to learn more about Spring? Then check out our detailed example on Spring Netbeans!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/","og_locale":"en_US","og_type":"article","og_title":"Spring Netbeans Example - Java Code Geeks","og_description":"Interested to learn more about Spring? Then check out our detailed example on Spring Netbeans!","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2019-05-13T12:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Abhishek Kothari","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Abhishek Kothari","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/"},"author":{"name":"Abhishek Kothari","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/824bb183aec8b131998976063d2926ef"},"headline":"Spring Netbeans Example","datePublished":"2019-05-13T12:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/"},"wordCount":1811,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg","keywords":["Netbeans"],"articleSection":["spring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/","name":"Spring Netbeans Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg","datePublished":"2019-05-13T12:00:00+00:00","description":"Interested to learn more about Spring? Then check out our detailed example on Spring Netbeans!","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/spring-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/spring\/spring-netbeans-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/"},{"@type":"ListItem","position":4,"name":"spring","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/spring\/"},{"@type":"ListItem","position":5,"name":"Spring Netbeans Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/824bb183aec8b131998976063d2926ef","name":"Abhishek Kothari","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0330027588516ca573c97a060605ee7e7b99fc40fd0037cf8d1bf5166b4e4bd6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0330027588516ca573c97a060605ee7e7b99fc40fd0037cf8d1bf5166b4e4bd6?s=96&d=mm&r=g","caption":"Abhishek Kothari"},"description":"Abhishek is a Web Developer with diverse skills across multiple Web development technologies. During his professional career, he has worked on numerous enterprise level applications and understood the technological architecture and complexities involved in making an exceptional project. His passion to share knowledge among the community through various mediums has led him towards being a Professional Online Trainer, Youtuber as well as Technical Content Writer.","url":"https:\/\/examples.javacodegeeks.com\/author\/abhishek-kothari\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/71214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/152"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=71214"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/71214\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1248"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=71214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=71214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=71214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}