Maven+SpringBoot环境搭建
来源:互联网 发布:php数组添加键值对 编辑:程序博客网 时间:2024/05/22 02:30
1.首先创建一个maven项目
2.maven项目创建完毕之后,其项目结构如下:
3.打开pom文件,并添加相关依赖:
<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>mangentSystem</groupId> <artifactId>mangetsystem</artifactId> <version>0.0.1-SNAPSHOT</version> <name>mangetsystem</name> <description>管理平台</description> <!-- 继承父包 --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.7.RELEASE</version> </parent> <!-- spring-boot的web启动的jar包 --> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> <!--maven的插件--> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> <!-- 配置java版本 不配置的话默认父类配置的是1.6--> <pluginManagement> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </pluginManagement> </build></project>
4.创建主类Application.java
package com.core;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.EnableAutoConfiguration;import org.springframework.context.annotation.ComponentScan;import org.springframework.context.annotation.Configuration;@Configuration@EnableAutoConfiguration//basePackages 声明扫描路径@ComponentScan(basePackages="com.boot.web")public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); }}5.创建属性文件application.proterties
spring.datasource.platform=mysql
spring.datasource.url=jdbc:mysql://localhost/springboot?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&failOverReadOnly=false
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driverClassName=com.mysql.jdbc.Driver
Advanced configuration…
spring.datasource.max-active=50
spring.datasource.max-idle=6
spring.datasource.min-idle=2
spring.datasource.initial-size=6
create table
spring.jpa.hibernate.ddl-auto=validate
//声明tomcat的端口号
server.port=8888
server.session-timeout=30
server.tomcat.uri-encoding=UTF-8
spring.thymeleaf.prefix=classpath:templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html
spring.thymeleaf.cache=false
5.在浏览器中输入localhost:8888/,调试结果如下:
- Maven+SpringBoot环境搭建
- 关于maven+dubbo+springboot环境的搭建
- maven环境搭建并运行springboot项目
- springboot多环境搭建
- springboot基础环境搭建
- springboot环境搭建
- Springboot-01-环境搭建
- springboot环境的搭建
- Springboot 环境搭建-helloworld
- SpringBoot 之环境搭建
- Maven搭建springboot项目demo
- Maven 搭建Maven环境
- 简单springboot及springboot cloud环境搭建
- SpringBoot项目实战--环境搭建
- SpringBoot(2) 搭建SpringFox环境
- SpringBoot -- Kafka(一) 环境搭建
- SpringBoot学习之环境搭建
- SpringBoot -- Kafka(一) 环境搭建
- Word Break Ⅱ
- java学习记录——求出1-50的所有素数以及累加和
- C++运算符重载详解
- HTTP状态码大全
- Task Schedule HDU
- Maven+SpringBoot环境搭建
- 创建生成word文档时候,iis出现无权限的问题{000209FF-0000-0000-C000-000000000046}
- Trie树
- 基于FreeRTOS与MQTT的物联网技术应用系列——步进电机控制(六)基于CrossApp跨平台框架的MQTT客户端控制应用PC版
- ORA-28000: the account is locked-的解决办法 解锁 SQL> conn /as sysdba 已连接。 SQL> alter user jd account unloc
- 基于OpenCV打开摄像头的控制台程序
- Shell终端输出字符的颜色总结
- 树链剖分bzoj3626
- Linux中MAVEN环境配置