Spring Boot构建应用
来源:互联网 发布:采集卡监控软件 编辑:程序博客网 时间:2024/05/29 18:06
一、Spring Boot简介
主要特性:
- Spring Boot Starter:它将常用的依赖分组进行整合,将其合并到一个依赖中,这样就可以一次性添加到项目到Maven构建中;
- 自动配置:Spring Boot的自动配置特性利用了Spring4对条件化配置对支持,合理地推测应用所需要的bean并自动配置它们;
- 命令行接口(CLI)
- Actuator
自动配置
Spring Boot的Starter减少了构建中依赖列表的长度,而Spring Boot的自动配置功能则削减了Spring配置的数量。它在实现时,会考虑应用中的其他因素并推断你需要的Spring配置。
二、使用Spring Boot构建应用
我们的应用是一个简单的联系人列表。(Contacts)
Maven构建
pom.xml配置:
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mook</groupId> <artifactId>contacts</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <repositories> <repository> <!-- Maven 自带的中央仓库使用的Id为central 如果其他的仓库声明也是用该Id 就会覆盖中央仓库的配置 --> <id>mvnrepository</id> <name>mvnrepository</name> <url>http://www.mvnrepository.com/</url> <layout>default</layout> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>springsource-repos</id> <name>SpringSource Repository</name> <url>http://repo.spring.io/release/</url> </repository> <repository> <id>central-repos</id> <name>Central Repository</name> <url>http://repo.maven.apache.org/maven2</url> </repository> <repository> <id>central-repos2</id> <name>Central Repository 2</name> <url>http://repo1.maven.org/maven2/</url> </repository> </repositories> <!--继承自spring-boot-starter-parent--> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.1.4.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf-spring4</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build></project>
Maven构架有一个parent醒目,让项目的Maven构建基于spring-boot-starter-parent,这样的话,受益于Maven的依赖管理功能,对于项目中的很多依赖,就没有必要明确声明版本号了,因为版本号会从parent中继承得到。
项目的标准结构:
处理请求
使用Spring MVC开发应用的WEB层,而Spring Boot的Web Starter能够将Spring MVC需要的所有内容一站式添加到构建中,其中版本号继承自parent。
编写控制类:ContactController
package contacts;import java.util.List;import java.util.Map;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;@Controller@RequestMapping("/")public class ContactController { private ContactRepository contactRepo; @Autowired public ContactController(ContactRepository contactRepo) { this.contactRepo = contactRepo; } @RequestMapping(method=RequestMethod.GET) public String home(Map<String,Object> model) { List<Contact> contacts = contactRepo.findAll(); model.put("contacts", contacts); return "home"; } @RequestMapping(method=RequestMethod.POST) public String submit(Contact contact) { contactRepo.save(contact); return "redirect:/"; }}
模型类(POJO):Contact
package contacts;public class Contact { private Long id; private String firstName; private String lastName; private String phoneNumber; private String emailAddress; public void setId(Long id) { this.id = id; } public Long getId() { return id; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getFirstName() { return firstName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getLastName() { return lastName; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } public String getPhoneNumber() { return phoneNumber; } public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } public String getEmailAddress() { return emailAddress; }}
创建视图
Thymeleaf的原生模板比JSP更加便于使用,而且它能够让我们以HTML的形式编写模板。
Spring Boot自动配置视图解析器、模板解析器、模板引擎。
控制类中的home()方法返回的逻辑视图名为home,所以模板文件应该命名为home.html,自动配置的模板解析器会在“src/main/resources/templates”下查找Thymeleaf模板。
Thymeleaf模板:home.html
<!DOCTYPE html><html xmlns:th="http://www.thymeleaf.org"> <head> <title>Spring Boot Contacts</title> <link rel="stylesheet" th:href="@{/style.css}" /> </head> <body> <h2>Spring Boot Contacts</h2> <form method="POST"> <label for="firstName">First Name:</label> <input type="text" name="firstName"></input><br/> <label for="lastName">Last Name:</label> <input type="text" name="lastName"></input><br/> <label for="phoneNumber">Phone #:</label> <input type="text" name="phoneNumber"></input><br/> <label for="emailAddress">Email:</label> <input type="text" name="emailAddress"></input><br/> <input type="submit"></input> </form> <ul th:each="contact : ${contacts}"> <li> <span th:text="${contact.firstName}">First</span> <span th:text="${contact.lastName}">Last</span> : <span th:text="${contact.phoneNumber}">phoneNumber</span>, <span th:text="${contact.emailAddress}">emailAddress</span> </li> </ul> </body></html>
添加静态内容
当采用Spring Boot的Web自发配置来定义Spring MVC bean时,这些bean中包含了一个资源处理器,它会将“/**”映射到几个资源路径中。
- /META-INF/resources/
- /resources/
- /static/
- /public/
静态资源style.css样式表:
body { background-color: #eeeeee; font-family: sans-serif;}label { display: inline-block; width: 120px; text-align: right;}
持久化数据
使用H2数据库和JDBC(使用Spring的JdbcTemplate)
编写Repository类:
package contacts;import java.util.List;import java.sql.ResultSet;import java.sql.SQLException;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.jdbc.core.JdbcTemplate;import org.springframework.jdbc.core.RowMapper;import org.springframework.stereotype.Repository;@Repositorypublic class ContactRepository { private JdbcTemplate jdbc; @Autowired public ContactRepository(JdbcTemplate jdbc) { this.jdbc = jdbc; } public List<Contact> findAll() { return jdbc.query( "select id, firstName, lastName, phoneNumber, emailAddress " + "from contacts order by lastName", new RowMapper<Contact>() { public Contact mapRow(ResultSet rs, int rowNum) throws SQLException { Contact contact = new Contact(); contact.setId(rs.getLong(1)); contact.setFirstName(rs.getString(2)); contact.setLastName(rs.getString(3)); contact.setPhoneNumber(rs.getString(4)); contact.setEmailAddress(rs.getString(5)); return contact; } } ); } public void save(Contact contact) { jdbc.update( "insert into contacts " + "(firstName, lastName, phoneNumber, emailAddress) " + "values (?, ?, ?, ?)", contact.getFirstName(), contact.getLastName(), contact.getPhoneNumber(), contact.getEmailAddress()); }}
创建contacts表:
如果将该文件命名为schema.sql并将其放在类路径根下(“src/main/resources”),当应用启动时,就会找到这个文件并进行数据加载。
create table contacts ( id identity, firstName varchar(30) not null, lastName varchar(50) not null, phoneNumber varchar(13), emailAddress varchar(30));
启动应用
初始化spring boot配置的启动类:
package contacts;import org.springframework.boot.autoconfigure.EnableAutoConfiguration;import org.springframework.boot.SpringApplication;import org.springframework.context.annotation.ComponentScan;@ComponentScan@EnableAutoConfigurationpublic class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
spring-boot-starter-web依赖会创建内嵌的Tomcat依赖,所以直接运行启动类即可。
控制台信息:
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java -Didea.launcher.port=7532 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/tools.jar:/Users/mook/workspace/contacts/target/classes:/Users/mook/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.1.4.RELEASE/spring-boot-starter-web-1.1.4.RELEASE.jar:/Users/mook/.m2/repository/org/springframework/boot/spring-boot-starter/1.1.4.RELEASE/spring-boot-starter-1.1.4.RELEASE.jar:/Users/mook/.m2/repository/org/springframework/boot/spring-boot/1.1.4.RELEASE/spring-boot-1.1.4.RELEASE.jar:/Users/mook/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.1.4.RELEASE/spring-boot-autoconfigure-1.1.4.RELEASE.jar:/Users/mook/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.1.4.RELEASE/spring-boot-starter-logging-1.1.4.RELEASE.jar:/Users/mook/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.7/jcl-over-slf4j-1.7.7.jar:/Users/mook/.m2/repository/org/slf4j/jul-to-slf4j/1.7.7/jul-to-slf4j-1.7.7.jar:/Users/mook/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.7/log4j-over-slf4j-1.7.7.jar:/Users/mook/.m2/repository/ch/qos/logback/logback-classic/1.1.2/logback-classic-1.1.2.jar:/Users/mook/.m2/repository/ch/qos/logback/logback-core/1.1.2/logback-core-1.1.2.jar:/Users/mook/.m2/repository/org/yaml/snakeyaml/1.13/snakeyaml-1.13.jar:/Users/mook/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.1.4.RELEASE/spring-boot-starter-tomcat-1.1.4.RELEASE.jar:/Users/mook/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/7.0.54/tomcat-embed-core-7.0.54.jar:/Users/mook/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/7.0.54/tomcat-embed-el-7.0.54.jar:/Users/mook/.m2/repository/org/apache/tomcat/embed/tomcat-embed-logging-juli/7.0.54/tomcat-embed-logging-juli-7.0.54.jar:/Users/mook/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.3.3/jackson-databind-2.3.3.jar:/Users/mook/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.3.3/jackson-annotations-2.3.3.jar:/Users/mook/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.3.3/jackson-core-2.3.3.jar:/Users/mook/.m2/repository/org/hibernate/hibernate-validator/5.0.3.Final/hibernate-validator-5.0.3.Final.jar:/Users/mook/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar:/Users/mook/.m2/repository/org/jboss/logging/jboss-logging/3.1.1.GA/jboss-logging-3.1.1.GA.jar:/Users/mook/.m2/repository/com/fasterxml/classmate/1.0.0/classmate-1.0.0.jar:/Users/mook/.m2/repository/org/springframework/spring-core/4.0.6.RELEASE/spring-core-4.0.6.RELEASE.jar:/Users/mook/.m2/repository/org/springframework/spring-web/4.0.6.RELEASE/spring-web-4.0.6.RELEASE.jar:/Users/mook/.m2/repository/org/springframework/spring-aop/4.0.6.RELEASE/spring-aop-4.0.6.RELEASE.jar:/Users/mook/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar:/Users/mook/.m2/repository/org/springframework/spring-beans/4.0.6.RELEASE/spring-beans-4.0.6.RELEASE.jar:/Users/mook/.m2/repository/org/springframework/spring-context/4.0.6.RELEASE/spring-context-4.0.6.RELEASE.jar:/Users/mook/.m2/repository/org/springframework/spring-webmvc/4.0.6.RELEASE/spring-webmvc-4.0.6.RELEASE.jar:/Users/mook/.m2/repository/org/springframework/spring-expression/4.0.6.RELEASE/spring-expression-4.0.6.RELEASE.jar:/Users/mook/.m2/repository/org/thymeleaf/thymeleaf-spring4/2.1.3.RELEASE/thymeleaf-spring4-2.1.3.RELEASE.jar:/Users/mook/.m2/repository/org/thymeleaf/thymeleaf/2.1.3.RELEASE/thymeleaf-2.1.3.RELEASE.jar:/Users/mook/.m2/repository/ognl/ognl/3.0.6/ognl-3.0.6.jar:/Users/mook/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar:/Users/mook/.m2/repository/org/unbescape/unbescape/1.0/unbescape-1.0.jar:/Users/mook/.m2/repository/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar:/Users/mook/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/1.1.4.RELEASE/spring-boot-starter-jdbc-1.1.4.RELEASE.jar:/Users/mook/.m2/repository/org/springframework/spring-jdbc/4.0.6.RELEASE/spring-jdbc-4.0.6.RELEASE.jar:/Users/mook/.m2/repository/org/apache/tomcat/tomcat-jdbc/7.0.54/tomcat-jdbc-7.0.54.jar:/Users/mook/.m2/repository/org/apache/tomcat/tomcat-juli/7.0.54/tomcat-juli-7.0.54.jar:/Users/mook/.m2/repository/org/springframework/spring-tx/4.0.6.RELEASE/spring-tx-4.0.6.RELEASE.jar:/Users/mook/.m2/repository/com/h2database/h2/1.3.176/h2-1.3.176.jar:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain contacts.Application . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.1.4.RELEASE)2017-06-14 23:12:57.366 INFO 6599 --- [ main] contacts.Application : Starting Application on promote.cache-dns.local with PID 6599 (/Users/mook/workspace/contacts/target/classes started by mook in /Users/mook/workspace/contacts)2017-06-14 23:12:57.401 INFO 6599 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4ba2ca36: startup date [Wed Jun 14 23:12:57 CST 2017]; root of context hierarchy2017-06-14 23:12:57.801 INFO 6599 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'beanNameViewResolver': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]2017-06-14 23:12:58.252 INFO 6599 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$1da7747c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)2017-06-14 23:12:58.270 INFO 6599 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionAttributeSource' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)2017-06-14 23:12:58.278 INFO 6599 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionInterceptor' of type [class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)2017-06-14 23:12:58.282 INFO 6599 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)2017-06-14 23:12:58.584 INFO 6599 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Server initialized with port: 80802017-06-14 23:12:58.744 INFO 6599 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat2017-06-14 23:12:58.745 INFO 6599 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/7.0.542017-06-14 23:12:58.847 INFO 6599 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext2017-06-14 23:12:58.849 INFO 6599 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1452 ms2017-06-14 23:12:59.398 INFO 6599 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]2017-06-14 23:12:59.400 INFO 6599 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]2017-06-14 23:12:59.922 INFO 6599 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executing SQL script from URL [file:/Users/mook/workspace/contacts/target/classes/schema.sql]2017-06-14 23:12:59.926 INFO 6599 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executed SQL script from URL [file:/Users/mook/workspace/contacts/target/classes/schema.sql] in 3 ms.2017-06-14 23:13:00.016 INFO 6599 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]2017-06-14 23:13:00.162 INFO 6599 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String contacts.ContactController.home(java.util.Map<java.lang.String, java.lang.Object>)2017-06-14 23:13:00.163 INFO 6599 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String contacts.ContactController.submit(contacts.Contact)2017-06-14 23:13:00.165 INFO 6599 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)2017-06-14 23:13:00.165 INFO 6599 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)2017-06-14 23:13:00.184 INFO 6599 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]2017-06-14 23:13:00.185 INFO 6599 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]2017-06-14 23:13:00.506 INFO 6599 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup2017-06-14 23:13:00.609 INFO 6599 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080/http2017-06-14 23:13:00.611 INFO 6599 --- [ main] contacts.Application : Started Application in 28.669 seconds (JVM running for 29.26)2017-06-14 23:13:34.477 INFO 6599 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'2017-06-14 23:13:34.477 INFO 6599 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started2017-06-14 23:13:34.488 INFO 6599 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 11 ms
- Spring Boot构建应用
- 不使用 spring-boot-starter-parent 构建 spring boot 应用
- spring boot 入门-使用spring boot构建简单应用
- 使用Spring Boot快速构建应用
- 使用Spring Boot快速构建应用
- Spring Boot框架快速构建应用
- 使用Spring Boot快速构建应用
- 使用Spring Boot快速构建应用
- 使用Spring Boot快速构建应用
- 使用Spring Boot快速构建应用
- 使用Spring Boot快速构建应用
- 使用Spring Boot快速构建应用
- 使用Spring Boot快速构建应用
- Spring Boot(1)-快速构建应用
- 使用Spring Boot快速构建应用
- 使用Spring Boot快速构建应用
- spring boot 三分钟构建restful应用
- 使用 Spring Boot 快速构建 Spring 框架应用
- 提取有角度的形状的最小矩形,求其旋转角度、长宽
- webpack入门
- Linux--安装DNS
- 安卓百分百布局的使用
- 【Qarth框架系列】环境配置
- Spring Boot构建应用
- Windows环境下python2.7安装mysql-python
- 在Sublime Text中配置Python环境
- Django二(MySQL数据库)
- 用数据分析验证,王者荣耀完胜阴阳师,小学生才是最终的赢家
- ZOJ--1067:Color Me Less
- Ubuntu上Nginx+Django的部署
- Java中Date与Calendar小究以及应用Gregoriancalendar类实现简单的日历
- 【Netty基础】protobuf详解