


Share some frequently asked questions about web-mvc projects building SpringBoot on IDEA
This article mainly introduces a summary of the problems encountered in building a SpringBoot web-mvc project on IDEA. Friends in need can refer to it
I have been studying how to build a web-mvc project on IDEA these days. mvc's SpringBoot project, I followed online tutorials to build it step by step, but there were still a lot of problems.
In order to save everyone from taking some detours in the future, I am here to share the results of my research over the past few days, and I hope it can be helpful to everyone.
Here we first introduce the configuration information of various environments: idea2016.2.1 jdk1.8.0_31
Because SpringBoot has built-in tomcat, there is no need for additional tomcat configuration. Now Let’s start talking about how to build the SpringBoot web-mvc project on idea
Step 1:Create a new regular maven project in IDEA. Please see the following diagram for the specific steps:
Step 2:
1. First copy the following code to pox.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.example</groupId> <artifactId>demo</artifactId> <version>0.0.1-SNAPSHOT</version> <packagingexample>jar</packagingexample> <name>demo</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.0.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>2. Click the jar package dependency update button in maven , please see the following illustration for specific operations:
body { padding: 0px; margin: auto; font-family: "黑体", "仿宋", Arial, "Arial Unicode MS", System; background-color: #00F; font-size: 20px; text-align: left; }welcome.html :
<html> <head> <title>Title</title> </head> <link href="css/csstest.css" rel="external nofollow" rel="stylesheet"/> <body> <p>welcome page is login.........</p> </body> </html>Code information of the application.properties configuration file:
#修改tomcat的默认的端口号,将8080改为8888 server.port=88884. Write the controller and project startup entry for Web-Mvc in SpringBoot:
package example; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }HelloController.java specific code:
package example; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.HashMap; import java.util.Map; @Controller public class HelloController { @RequestMapping("/index") public String index(){ return "welcome"; } }In this way, the SpringBoot Web-mvc project has been successfully built. The specific steps are as follows . One more important thing to note is: because I have modified the port number, the address must be written as 127.0.0.1:8888/index when accessing.
The above is the detailed content of Share some frequently asked questions about web-mvc projects building SpringBoot on IDEA. For more information, please follow other related articles on the PHP Chinese website!

The article discusses using Maven and Gradle for Java project management, build automation, and dependency resolution, comparing their approaches and optimization strategies.

The article discusses creating and using custom Java libraries (JAR files) with proper versioning and dependency management, using tools like Maven and Gradle.

The article discusses implementing multi-level caching in Java using Caffeine and Guava Cache to enhance application performance. It covers setup, integration, and performance benefits, along with configuration and eviction policy management best pra

The article discusses using JPA for object-relational mapping with advanced features like caching and lazy loading. It covers setup, entity mapping, and best practices for optimizing performance while highlighting potential pitfalls.[159 characters]

Java's classloading involves loading, linking, and initializing classes using a hierarchical system with Bootstrap, Extension, and Application classloaders. The parent delegation model ensures core classes are loaded first, affecting custom class loa


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Zend Studio 13.0.1
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft