- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我已经配置了一个 Spring Boot 应用程序,但在启动该应用程序时,我收到如下映射错误
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Mon Dec 24 12:46:27 IST 2018
There was an unexpected error (type=Not Found, status=404).
No message available
。我已经浏览了下面的链接,并将我的 Controller 更新为包含主类的根包的一部分。 This application has no explicit mapping for /error
我在我的应用程序中使用了下面提到的配置/代码:
build.gradle
buildscript {
ext {
springBootVersion = '2.1.1.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.ticket'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation('javax.servlet:jstl')
implementation('org.springframework.boot:spring-boot-starter-web')
runtimeOnly('com.h2database:h2')
testImplementation('org.springframework.boot:spring-boot-starter-test')
}
TicketController.java
package com.ticket.controller;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
@RestController
public class TicketController {
static Logger log = LogManager.getLogger();
@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView homeScreen(ModelMap model) {
return new ModelAndView("view");
}
}
application.properties
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
Jsp path
src/main/webapp/WEB-INF/jsp/view.jsp
最佳答案
答案非常简单,如果您使用 thymeleaf,请将以下几行添加到您的 pom.xml 中:
<dependency>
<groupId> org.springframework.boot </groupId>
<artifactId> spring-boot-starter-thymeleaf </artifactId>
</dependency>
就这样,你必须把你的 View 放在src/main/resources/templates
的templates包中
如果您使用 jsp 文件作为 View ,则上述方法不起作用,您必须将以下行添加到您的 application.properties 文件中:
spring.mvc.view.prefix = / WEB-INF / views /
spring.mvc.view.suffix = .jsp
前面的行表示驱动程序将在其中查找 View 的文件夹,并且它们也必须与该文件夹结构一起存在。
以及您的 pom.xml 这些行:
**
<dependency>
<groupId> org.apache.tomcat.embed </groupId>
<artifactId> tomcat-embed-jasper </artifactId>
<scope> provided </scope>
</dependency>
**
就是这样,spring boot 表明它找不到所请求的资源,但根据上面已经描述的内容,必须解决它。
关于java - 白标错误页面 - 应用程序没有明确的映射/错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53911100/
我们有一个 Android 项目,我们为不同的客户维护一个单一的代码库,每次为不同的客户编译的最快/最有效的方法是什么?我找到的几个选项和我的问题: 编写脚本:替换资源文件夹,编辑应用名称、版本等 使
我们销售的服务包括打包在 MSI 中的 .NET 应用程序,该应用程序与网络服务相结合。 我们有不少客户希望以他们的品牌/ Logo 等方式转售我们的应用程序。我们真正需要做的就是更改任务栏图标、桌面
我想构建一个 iOS 白标应用程序,该应用程序应该可以在一定程度上进行自定义,然后无需人工干预即可提交到应用程序商店。所以我想知道 Apple 是否有 API 支持,让我可以与 iTunes 对话并代
我必须为 iOS 应用程序添加白标签,但我想不出最好的方法。 我知道 Android 有“Product Flavors”,允许您自定义应用程序并在同一个项目中创建它的多个版本。 我没有找到在 iOS
我有一个 ASP.NET web 应用程序,印度的商业客户希望购买并在他们的经营场所内运行(它用于工业用途)。我这样做的最佳方法是什么,但不会失去对我的 IP 的控制?我有一些担忧: 是否仍需要混淆
大家好,即使我已经按照他们网站上的 spring 教程进行操作,我仍然会收到此错误。我一直在努力弄清楚为什么会出现此错误。我能够连接到 facebook,但是当尝试像 spring 提供的教程那样检索
这里已经有一些信息:White labeling an iOS app 我想知道是否有任何工作流程可以为 React Native 应用程序添加白标? 基本上,如果我有一个应用商店的核心应用程序。我想
我们已经在各自的应用程序商店中提供了 IOS 和 Android 应用程序。我们现在正计划给它们贴上白色标签。a) 每个使用我们的白标解决方案的客户都将使用他们自己的主题、 Logo 和可能很少的自定
我正在构建的 Flutter Web 应用程序具有基于 URL 查询字符串 /#?brd=BrandName 的白标签功能......根据要求,白标签必须基于作为域的 url 参数 brd 对于所有品
我是一名优秀的程序员,十分优秀!