SpringBoot是Pivotal团队提供的全新框架,它的存在减少了我们对代码的需求,前面我们在进行Spring项目搭建的时候导入了很多依赖,正是因为SpringBoot的产生让我们减少了很多依赖的注入。它最重要的是自带Tomcat服务器,让我们在启动项目的时候不用那么繁琐的去配置Tomcat的很多配置,我们只需要在其中写一个Controller方法,并且加上注解,便可以将Tomcat启动,以及让整个项目跑动起来,正是前人的聪明让我们如今在实际项目中达到了高效性。其实它就是一些库的集合,它能够被任意项目的构建系统所使用。
以下是我查找了别人的代码并且加上自己的理解让整个项目跑动起来,亲测有效。
这是我项目中结构:
pom.xml代码:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- $Id: pom.xml 642118 2008-03-28 08:04:16Z reinhard $ -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns