{"id":16828,"date":"2011-11-15T10:05:20","date_gmt":"2011-11-15T08:05:20","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=16828"},"modified":"2013-09-03T21:23:32","modified_gmt":"2013-09-03T18:23:32","slug":"bootstrapping-web-application-with","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html","title":{"rendered":"Bootstrap a Web Application with Spring 3"},"content":{"rendered":"<h2>1. Overview<\/h2>\n<p>This is the <strong>first<\/strong> of a series of tutorials about setting up a RESTfull web application using Spring 3.1 with Java based configuration. The article will focus on <strong>bootstrapping the web application<\/strong>, discussing how to make the jump from XML to Java without having to completely migrate the entire XML configuration.<\/p>\n<h2>2. The Maven <em>pom.xml<\/em><\/h2>\n<p>&nbsp;<br \/>\n&nbsp;<\/p>\n<pre class=\" brush:xml\">&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" \r\n   xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n   xsi:schemaLocation=\"\r\n      http:\/\/maven.apache.org\/POM\/4.0.0 \r\n      http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\r\n   &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n   &lt;groupId&gt;org&lt;\/groupId&gt;\r\n   &lt;artifactId&gt;rest&lt;\/artifactId&gt;\r\n   &lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\r\n   &lt;packaging&gt;war&lt;\/packaging&gt;\r\n\r\n   &lt;dependencies&gt;\r\n\r\n      &lt;dependency&gt;\r\n         &lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n         &lt;artifactId&gt;spring-webmvc&lt;\/artifactId&gt;\r\n         &lt;version&gt;${spring.version}&lt;\/version&gt;\r\n         &lt;exclusions&gt;\r\n            &lt;exclusion&gt;\r\n               &lt;artifactId&gt;commons-logging&lt;\/artifactId&gt;\r\n               &lt;groupId&gt;commons-logging&lt;\/groupId&gt;\r\n            &lt;\/exclusion&gt;\r\n         &lt;\/exclusions&gt;\r\n      &lt;\/dependency&gt;\r\n      &lt;dependency&gt;\r\n         &lt;groupId&gt;cglib&lt;\/groupId&gt;\r\n         &lt;artifactId&gt;cglib-nodep&lt;\/artifactId&gt;\r\n         &lt;version&gt;${cglib.version}&lt;\/version&gt;\r\n         &lt;scope&gt;runtime&lt;\/scope&gt;\r\n      &lt;\/dependency&gt;\r\n\r\n   &lt;\/dependencies&gt;\r\n\r\n   &lt;build&gt;\r\n      &lt;finalName&gt;rest&lt;\/finalName&gt;\r\n\r\n      &lt;plugins&gt;\r\n         &lt;plugin&gt;\r\n            &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\r\n            &lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;\r\n            &lt;version&gt;3.1&lt;\/version&gt;\r\n            &lt;configuration&gt;\r\n               &lt;source&gt;1.6&lt;\/source&gt;\r\n               &lt;target&gt;1.6&lt;\/target&gt;\r\n               &lt;encoding&gt;UTF-8&lt;\/encoding&gt;\r\n            &lt;\/configuration&gt;\r\n         &lt;\/plugin&gt;\r\n      &lt;\/plugins&gt;\r\n   &lt;\/build&gt;\r\n\r\n   &lt;properties&gt;\r\n      &lt;spring.version&gt;3.2.2.RELEASE&lt;\/spring.version&gt;\r\n      &lt;cglib.version&gt;2.2.2&lt;\/cglib.version&gt;\r\n   &lt;\/properties&gt;\r\n\r\n&lt;\/project&gt;<\/pre>\n<h4>2.1. Justification of the <em>cglib<\/em> dependency<\/h4>\n<p>You may wonder why <em>cglib<\/em> is a dependency \u2013 it turns out there is a valid reason to include it \u2013 the entire configuration cannot function without it. If removed, Spring will throw:<\/p>\n<blockquote>\n<p><em>Caused by: java.lang.IllegalStateException: CGLIB is required to process @Configuration classes. Either add CGLIB to the classpath or remove the following @Configuration bean definitions<\/em><\/p>\n<\/blockquote>\n<p>The reason this happens is explained by the way Spring deals with <em>@Configuration<\/em> classes. These classes are effectively beans, and because of this they need to be aware of the Context, and respect scope and other bean semantics. This is achieved by dynamically creating a cglib proxy with this awareness for each <em>@Configuration<\/em> class, hence the cglib dependency.<\/p>\n<p>Also, because of this, there are a few restrictions for <em>Configuration<\/em> annotated classes:<\/p>\n<ul>\n<li>Configuration classes <strong>should not be final<\/strong><\/li>\n<li>They should have a constructor with no arguments<\/li>\n<\/ul>\n<h4>2.2. The <em>cglib<\/em> dependency in Spring 3.2<br \/>\n<\/h4>\n<p>Starting with Spring 3.2, it is <strong>no longer necessary to add <em>cglib<\/em> as an explicit dependency<\/strong>. This is because Spring is in now inlining <em>cglib<\/em> \u2013 which will ensure that all class based proxying functionality will work out of the box with Spring 3.2.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>The new cglib code is placed under the Spring package: <em>org.springframework.cglib<\/em> (replacing the original <em>net.sf.cglib<\/em>). The reason for the package change is to avoid conflicts with any <em>cglib<\/em> versions already existing on the classpath.<\/p>\n<p>Also, the new cglib 3.0 is now used, upgraded from the older 2.2 dependency (see this <a title=\"Upgrade to ASM 4.0 and CGLIB 3.0\" href=\"https:\/\/jira.springsource.org\/browse\/SPR-9669\" target=\"_blank\" rel=\"nofollow\">JIRA issue<\/a> for more details).<\/p>\n<h2>3. The Java based web configuration<\/h2>\n<pre class=\" brush:java\">@Configuration\r\n@ImportResource( { \"classpath*:\/rest_config.xml\" } )\r\n@ComponentScan( basePackages = \"org.rest\" )\r\n@PropertySource({ \"classpath:rest.properties\", \"classpath:web.properties\" })\r\npublic class AppConfig{\r\n\r\n   @Bean\r\n\u00a0\u00a0 public static PropertySourcesPlaceholderConfigurer properties() {\r\n\u00a0\u00a0    return new PropertySourcesPlaceholderConfigurer();\r\n\u00a0\u00a0 }\r\n}<\/pre>\n<p>First, the <strong><em>@Configuration<\/em><\/strong> annotation \u2013 this is the main artifact used by the Java based Spring configuration; it is itself meta-annotated with <em>@Component<\/em>, which makes the annotated classes <strong>standard beans<\/strong> and as such, also candidates for component scanning. The main purpose of <em>@Configuration<\/em> classes is to be sources of bean definitions for the Spring IoC Container. For a more detailed description, see the <a title=\"Java based container configuration - the 3.1 official Spring reference\" href=\"http:\/\/static.springsource.org\/spring\/docs\/3.1.x\/spring-framework-reference\/html\/beans.html#beans-java\" target=\"_blank\" rel=\"nofollow\">official docs<\/a>.<\/p>\n<p>Then, <strong><em>@ImportResource<\/em><\/strong> is used to import the existing XML based Spring configuration. This may be configuration which is still being migrated from XML to Java, or simply legacy configuration that you wish to keep. Either way, importing it into the Container is essential for a successful migration, allowing small steps without to much risk. The equivalent XML annotation that is replaced is:<\/p>\n<p><em>&lt;import resource=\u201dclasspath*:\/rest_config.xml\u201d \/&gt;<\/em><\/p>\n<p>Moving on to <strong><em>@ComponentScan<\/em><\/strong> \u2013 this configures the component scanning directive, effectively replacing the XML:<\/p>\n<pre class=\" brush:xml\">&lt;context:component-scan base-package=\"org.rest\" \/&gt;<\/pre>\n<p>As of Spring 3.1, the <em>@Configuration<\/em> are excluded from classpath scanning by default \u2013 see <a title=\"JIRA - Allow @Configuration classes to self-@ComponentScan\" href=\"https:\/\/jira.springsource.org\/browse\/SPR-8808\" target=\"_blank\" rel=\"nofollow\">this JIRA issue<\/a>. Before Spring 3.1 though, these classes should have been excluded explicitly:<\/p>\n<pre class=\" brush:java\">excludeFilters = { @ComponentScan.Filter( Configuration.class ) }<\/pre>\n<p>The <em>@Configuration<\/em> classes should not be autodiscovered because they are already specified and used by the Container \u2013 allowing them to be rediscovered and introduced into the Spring context will result in the following error:<\/p>\n<blockquote>\n<p><em>Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name \u2018webConfig\u2019 for bean class [org.rest.spring.AppConfig] conflicts with existing, non-compatible bean definition of same name and class [org.rest.spring.AppConfig]<\/em><\/p>\n<\/blockquote>\n<p>And finally, using the<strong> @Bean<\/strong> annotation to configure the <strong>properties support<\/strong> &#8211;\u00a0<em>PropertySourcesPlaceholderConfigurer<\/em> is initialized in a <em>@Bean<\/em> annotated method, indicating it will produce a Spring bean managed by the Container. This new configuration has replaced the following XML:<\/p>\n<pre class=\" brush:xml\">&lt;context:property-placeholder\r\nlocation=\"classpath:persistence.properties, classpath:web.properties\"\r\nignore-unresolvable=\"true\"\/&gt;<\/pre>\n<p>For a more in detph discussion on why it was necessary to manually register the <em>PropertySourcesPlaceholderConfigurer<\/em> bean, see the <a title=\"Spring Properties\" href=\"http:\/\/www.baeldung.com\/2012\/02\/06\/properties-with-spring\/\">Properties with Spring Tutorial<\/a>.<\/p>\n<h4>3.1. The <em>web.xml<\/em><\/h4>\n<pre class=\" brush:xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;web-app xmlns=\"\r\n       http:\/\/java.sun.com\/xml\/ns\/javaee\"\r\n\u00a0\u00a0 \u00a0   xmlns:web=\"http:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_3_0.xsd\"\r\n\u00a0\u00a0 \u00a0   xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n\u00a0\u00a0 \u00a0xsi:schemaLocation=\"\r\n       http:\/\/java.sun.com\/xml\/ns\/javaee \r\n       http:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_3_0.xsd\"\r\n\u00a0\u00a0 \u00a0id=\"rest\" version=\"3.0\"&gt;\r\n\r\n   &lt;context-param&gt;\r\n      &lt;param-name&gt;contextClass&lt;\/param-name&gt;\r\n      &lt;param-value&gt;\r\n         org.springframework.web.context.support.AnnotationConfigWebApplicationContext\r\n      &lt;\/param-value&gt;\r\n   &lt;\/context-param&gt;\r\n   &lt;context-param&gt;\r\n      &lt;param-name&gt;contextConfigLocation&lt;\/param-name&gt;\r\n      &lt;param-value&gt;org.rest.spring.root&lt;\/param-value&gt;\r\n   &lt;\/context-param&gt;\r\n   &lt;listener&gt;\r\n      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;\/listener-class&gt;\r\n   &lt;\/listener&gt;\r\n\r\n   &lt;servlet&gt;\r\n      &lt;servlet-name&gt;rest&lt;\/servlet-name&gt;\r\n      &lt;servlet-class&gt;\r\n         org.springframework.web.servlet.DispatcherServlet\r\n      &lt;\/servlet-class&gt;\r\n      &lt;init-param&gt;\r\n         &lt;param-name&gt;contextClass&lt;\/param-name&gt;\r\n         &lt;param-value&gt;\r\n            org.springframework.web.context.support.AnnotationConfigWebApplicationContext\r\n         &lt;\/param-value&gt;\r\n      &lt;\/init-param&gt;\r\n      &lt;init-param&gt;\r\n         &lt;param-name&gt;contextConfigLocation&lt;\/param-name&gt;\r\n         &lt;param-value&gt;org.rest.spring.rest&lt;\/param-value&gt;\r\n      &lt;\/init-param&gt;\r\n      &lt;load-on-startup&gt;1&lt;\/load-on-startup&gt;\r\n   &lt;\/servlet&gt;\r\n   &lt;servlet-mapping&gt;\r\n      &lt;servlet-name&gt;rest&lt;\/servlet-name&gt;\r\n      &lt;url-pattern&gt;\/api\/*&lt;\/url-pattern&gt;\r\n   &lt;\/servlet-mapping&gt;\r\n\r\n   &lt;welcome-file-list&gt;\r\n      &lt;welcome-file \/&gt;\r\n   &lt;\/welcome-file-list&gt;\r\n\r\n&lt;\/web-app&gt;<\/pre>\n<p>First, the root context is defined and configured to use <em>AnnotationConfigWebApplicationContext<\/em> instead of the default <em>XmlWebApplicationContext<\/em>. The newer <em>AnnotationConfigWebApplicationContext<\/em> accepts <em>@Configuration<\/em> annotated classes as input for the Container configuration and is needed in order to set up the Java based context.<\/p>\n<p>Unlike <em>XmlWebApplicationContext<\/em>, it assumes no default configuration class locations, so the <em>\u201ccontextConfigLocation\u201d<\/em> <em>init-param<\/em> for the Servlet must be set. This will point to the java package where the <em>@Configuration<\/em> classes are located; the fully qualified name(s) of the classes are also supported.<\/p>\n<p>Next, the <em>DispatcherServlet<\/em> is configured to use the same kind of context, with the only difference that it\u2019s loading configuration classes out of a different package.<\/p>\n<p>Other than this, the <em>web.xml<\/em> doesn\u2019t really change from a XML to a Java based configuration.<\/p>\n<h2>4. Conclusion<\/h2>\n<p>The presented approach allows for a smooth <strong>migration of the Spring configuration<\/strong> from XML to Java, mixing the old and the new. This is important for older projects, which may have a lot of XML based configuration that cannot be migrated all at once. This way, the <em>web.xml<\/em> and bootstrapping of the application is the first step in a migration, after which the remaining XML beans can be ported in small increments.<\/p>\n<p>In <a title=\"Building a REST API with Spring 3 Tutorial\" href=\"http:\/\/www.baeldung.com\/2011\/10\/25\/building-a-restful-web-service-with-spring-3-1-and-java-based-configuration-part-2\/\">the next article on REST with Spring<\/a>, I cover setting up MVC in the project, configuration of the HTTP status codes, payload marshalling and content negotiation. In the meantime, you can check out the <a title=\"the github REST project containing the entire Java based configuration material\" href=\"https:\/\/github.com\/eugenp\/REST#readme\" target=\"_blank\" rel=\"nofollow\">github project<\/a>.<br \/>\n&nbsp;<\/p>\n<div style=\"border: 1px solid #D8D8D8; background: #FAFAFA; width: 100%; padding-left: 5px;\"><b><i>Reference: <\/i><\/b><a href=\"http:\/\/www.baeldung.com\/2011\/10\/20\/bootstraping-a-web-application-with-spring-3-1-and-java-based-configuration-part-1\/\">Bootstrap a Web Application with Spring 3<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/jcg\">JCG partner<\/a> Eugen Paraschiv at the <a href=\"http:\/\/www.baeldung.com\/\">baeldung<\/a> blog.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. Overview This is the first of a series of tutorials about setting up a RESTfull web application using Spring 3.1 with Java based configuration. The article will focus on bootstrapping the web application, discussing how to make the jump from XML to Java without having to completely migrate the entire XML configuration. 2. The &hellip;<\/p>\n","protected":false},"author":104,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[30],"class_list":["post-16828","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-spring"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Bootstrap a Web Application with Spring 3<\/title>\n<meta name=\"description\" content=\"1. Overview This is the first of a series of tutorials about setting up a RESTfull web application using Spring 3.1 with Java based configuration. The\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bootstrap a Web Application with Spring 3\" \/>\n<meta property=\"og:description\" content=\"1. Overview This is the first of a series of tutorials about setting up a RESTfull web application using Spring 3.1 with Java based configuration. The\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-15T08:05:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-09-03T18:23:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/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=\"Eugen Paraschiv\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/baeldung\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Eugen Paraschiv\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/bootstrapping-web-application-with.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/bootstrapping-web-application-with.html\"},\"author\":{\"name\":\"Eugen Paraschiv\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/7a8ad27f4bb34bb3664fda07d3142bc4\"},\"headline\":\"Bootstrap a Web Application with Spring 3\",\"datePublished\":\"2011-11-15T08:05:20+00:00\",\"dateModified\":\"2013-09-03T18:23:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/bootstrapping-web-application-with.html\"},\"wordCount\":881,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/bootstrapping-web-application-with.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"Spring\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/bootstrapping-web-application-with.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/bootstrapping-web-application-with.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/bootstrapping-web-application-with.html\",\"name\":\"Bootstrap a Web Application with Spring 3\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/bootstrapping-web-application-with.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/bootstrapping-web-application-with.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2011-11-15T08:05:20+00:00\",\"dateModified\":\"2013-09-03T18:23:32+00:00\",\"description\":\"1. Overview This is the first of a series of tutorials about setting up a RESTfull web application using Spring 3.1 with Java based configuration. The\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/bootstrapping-web-application-with.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/bootstrapping-web-application-with.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/bootstrapping-web-application-with.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"spring-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/11\\\/bootstrapping-web-application-with.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Bootstrap a Web Application with Spring 3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/7a8ad27f4bb34bb3664fda07d3142bc4\",\"name\":\"Eugen Paraschiv\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d1e55876feb753ccc6de08d413df2c915e5704dd901010340c1499a7572f8d7a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d1e55876feb753ccc6de08d413df2c915e5704dd901010340c1499a7572f8d7a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d1e55876feb753ccc6de08d413df2c915e5704dd901010340c1499a7572f8d7a?s=96&d=mm&r=g\",\"caption\":\"Eugen Paraschiv\"},\"sameAs\":[\"http:\\\/\\\/www.baeldung.com\\\/\",\"http:\\\/\\\/www.linkedin.com\\\/in\\\/eugenparaschiv\",\"https:\\\/\\\/x.com\\\/http:\\\/\\\/twitter.com\\\/baeldung\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Eugen-Paraschiv\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Bootstrap a Web Application with Spring 3","description":"1. Overview This is the first of a series of tutorials about setting up a RESTfull web application using Spring 3.1 with Java based configuration. The","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:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html","og_locale":"en_US","og_type":"article","og_title":"Bootstrap a Web Application with Spring 3","og_description":"1. Overview This is the first of a series of tutorials about setting up a RESTfull web application using Spring 3.1 with Java based configuration. The","og_url":"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2011-11-15T08:05:20+00:00","article_modified_time":"2013-09-03T18:23:32+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Eugen Paraschiv","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/twitter.com\/baeldung","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Eugen Paraschiv","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html"},"author":{"name":"Eugen Paraschiv","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/7a8ad27f4bb34bb3664fda07d3142bc4"},"headline":"Bootstrap a Web Application with Spring 3","datePublished":"2011-11-15T08:05:20+00:00","dateModified":"2013-09-03T18:23:32+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html"},"wordCount":881,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["Spring"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html","url":"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html","name":"Bootstrap a Web Application with Spring 3","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2011-11-15T08:05:20+00:00","dateModified":"2013-09-03T18:23:32+00:00","description":"1. Overview This is the first of a series of tutorials about setting up a RESTfull web application using Spring 3.1 with Java based configuration. The","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","width":150,"height":150,"caption":"spring-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2011\/11\/bootstrapping-web-application-with.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Bootstrap a Web Application with Spring 3"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/7a8ad27f4bb34bb3664fda07d3142bc4","name":"Eugen Paraschiv","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d1e55876feb753ccc6de08d413df2c915e5704dd901010340c1499a7572f8d7a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d1e55876feb753ccc6de08d413df2c915e5704dd901010340c1499a7572f8d7a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d1e55876feb753ccc6de08d413df2c915e5704dd901010340c1499a7572f8d7a?s=96&d=mm&r=g","caption":"Eugen Paraschiv"},"sameAs":["http:\/\/www.baeldung.com\/","http:\/\/www.linkedin.com\/in\/eugenparaschiv","https:\/\/x.com\/http:\/\/twitter.com\/baeldung"],"url":"https:\/\/www.javacodegeeks.com\/author\/Eugen-Paraschiv"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/16828","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/104"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=16828"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/16828\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/240"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=16828"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=16828"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=16828"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}