<?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.pluralsight</groupId>
<artifactId>event-tracker</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>event-tracker</name>
<description>An app to track our Events</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<!--<version>1.0.2.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-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.pluralsight;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "com.pluralsight")
public class WebConfig {
}
WebAppInitializer:
package com.pluralsight;
import javax.servlet.ServletContext;
import javax.servlet.ServletRegistration;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
public class WebAppInitializer implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext servletContext) {
WebApplicationContext context = getContext();
servletContext.addListener(new ContextLoaderListener(context));
ServletRegistration.Dynamic dispatcher = servletContext.addServlet("DispatcherServlet", new DispatcherServlet(context));
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping("*.html");
}
private AnnotationConfigWebApplicationContext getContext() {
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
context.setConfigLocation("com.pluralsight.WebConfig");
return context;
}
}
HelloController:
package com.pluralsight.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HelloController {
@RequestMapping(value = "/greeting")
public String sayHello(Model model) {
model.addAttribute("greeting", "Hello World");
return "hello.jsp";
}
}
pom.xml 与Spring Boot starter父级相关的最新升级版本
当我尝试在Eclipse上运行任何Maven命令时,会出现一个错误。 错误消息: pom.xml文件: Maven版本:
本文向大家介绍解析spring-boot-starter-parent简介,包括了解析spring-boot-starter-parent简介的使用技巧和注意事项,需要的朋友参考一下 本指南将帮助您了解Spring Boot Starter Parent如何帮助管理依赖项版本,所有Spring Boot项目通常使用spring-boot-starter-parent作为pom.xml中的父项: P
我尝试使用以下命令升级pip3: 安装升级pip 但不幸的是,它不再工作,并显示以下信息: pip3——版本 信息: 回溯(最后一次调用): 文件/usr/local/lib/python3.4/dist-packages/pkg_-resources/init.py”,第651行,在“构建主ws.require(requires) 文件/usr/local/lib/python3.4/dist-
有人能解释一下spring-boot-parent和spring-boot-starter-parent之间的区别吗?正如我在下面附上的一个GIT HUB代码链接中看到的,他们分别为spring-boot-starter-parent和spring-boot-parent编写了模块。 https://github.com/spring-projects/spring-boot/blob/maste
我从这里得到了一个很好的简单的SSO示例项目 加载http://localhost:8082/app1它将重定向到http://localhost:8080/sso-server的登录页 用户名:用户,密码:密码 现在我的问题是示例使用spring-boot-starter-parent版本1.5.9。release 现在在加载app1时,它将显示sso登录窗口。但成功登录后,会抛出404错误。