idea 开发spring boot应用程序

时间:2021-10-30 09:18:46

Spring boot 是什么?用来简化新Spring应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。

Spring Boot的目标不在于为已解决的问题域提供新的解决方案,而是为平台带来另一种开发体验,从而简化对这些已有技术的使用。对于已经熟悉Spring生态系统的开发人员来说,Boot是一个很理想的选择,不过对于采用Spring技术的新人来说,Boot提供一种更简洁的方式来使用这些技术。

当开发Web应用,尤其是RESTful Web服务的时候,如果包含了spring-boot-starter-web依赖,它就会为你提供启动嵌入式Tomcat容器的自动化配置

开发模式:

1.     开发微服务:内嵌tomcat

2.     配置默认情况下,应用的配置可以使用Java属性文件来进行定义,这个文件名为application.properties并且位于应用的classpath根目录下。不过,一种更好的方式是使用 YAML配置,它提供了结构化以及嵌套的配置。

3.     打包Boot应用:在Maven下执行打包,只需执行mvn package命令

4.     运行:java -jar path/to/myproject.jar

 

Spring boot 默认内嵌的tomcat是不支持jsp的,但通常我们的项目中有jsp,所以需要稍微改造一下。

 

Demo工程目录结构如下

 idea 开发spring boot应用程序

开发环境搭建(idea14)

1.检出项目后设置

idea 开发spring boot应用程序

2. 从当前项目设置war包

idea 开发spring boot应用程序

3.安装tomcat

idea 开发spring boot应用程序

4.配置项目运行环境

 idea 开发spring boot应用程序

5.配置Tomcat相关参数

 idea 开发spring boot应用程序

 

6.添加项目

idea 开发spring boot应用程序

目前支持的starter-poms

Spring Boot application starters

Name

Description

spring-boot-starter

The core Spring Boot starter, including auto-configuration support, logging and YAML.

spring-boot-starter-actuator

Production ready features to help you monitor and manage your application.

spring-boot-starter-amqp

Support for the “Advanced Message Queuing Protocol” via spring-rabbit.

spring-boot-starter-aop

Support for aspect-oriented programming including spring-aop and AspectJ.

spring-boot-starter-artemis

Support for “Java Message Service API” via Apache Artemis.

spring-boot-starter-batch

Support for “Spring Batch” including HSQLDB database.

spring-boot-starter-cache

Support for Spring’s Cache abstraction.

spring-boot-starter-cloud-connectors

Support for “Spring Cloud Connectors” which simplifies connecting to services in cloud platforms like Cloud Foundry and Heroku.

spring-boot-starter-data-elasticsearch

Support for the Elasticsearch search and analytics engine including spring-data-elasticsearch.

spring-boot-starter-data-gemfire

Support for the GemFire distributed data store including spring-data-gemfire.

spring-boot-starter-data-jpa

Support for the “Java Persistence API” including spring-data-jpa, spring-orm and Hibernate.

spring-boot-starter-data-mongodb

Support for the MongoDB NoSQL Database, including spring-data-mongodb.

spring-boot-starter-data-rest

Support for exposing Spring Data repositories over REST via spring-data-rest-webmvc.

spring-boot-starter-data-solr

Support for the Apache Solr search platform, including spring-data-solr.

spring-boot-starter-freemarker

Support for the FreeMarker templating engine.

spring-boot-starter-groovy-templates

Support for the Groovy templating engine.

spring-boot-starter-hateoas

Support for HATEOAS-based RESTful services via spring-hateoas.

spring-boot-starter-hornetq

Support for “Java Message Service API” via HornetQ.

spring-boot-starter-integration

Support for common spring-integration modules.

spring-boot-starter-jdbc

Support for JDBC databases.

spring-boot-starter-jersey

Support for the Jersey RESTful Web Services framework.

spring-boot-starter-jta-atomikos

Support for JTA distributed transactions via Atomikos.

spring-boot-starter-jta-bitronix

Support for JTA distributed transactions via Bitronix.

spring-boot-starter-mail

Support for javax.mail.

spring-boot-starter-mobile

Support for spring-mobile.

spring-boot-starter-mustache

Support for the Mustache templating engine.

spring-boot-starter-redis

Support for the REDIS key-value data store, including spring-redis.

spring-boot-starter-security

Support for spring-security.

spring-boot-starter-social-facebook

Support for spring-social-facebook.

spring-boot-starter-social-linkedin

Support for spring-social-linkedin.

spring-boot-starter-social-twitter

Support for spring-social-twitter.

spring-boot-starter-test

Support for common test dependencies, including JUnit, Hamcrest and Mockito along with the spring-test module.

spring-boot-starter-thymeleaf

Support for the Thymeleaf templating engine, including integration with Spring.

spring-boot-starter-velocity

Support for the Velocity templating engine.

spring-boot-starter-web

Support for full-stack web development, including Tomcat and spring-webmvc.

spring-boot-starter-websocket

Support for WebSocket development.

spring-boot-starter-ws

Support for Spring Web Services.