Ank*_*ena 5 browser spring hal spring-boot actuator
更新:附加pom.xml和application.property更多错误/警告消息。
嗨,我对 Spring Boot 非常陌生,只是在 Udemy 上学习了一些课程。
在学习课程时,我通过 spring.io 创建了一个入门项目,并添加了执行器和 Hal 浏览器依赖项,包括开发工具。
刚刚运行我的应用程序并尝试转到localhost:8080/application& /browser,但我得到 404。
我究竟做错了什么?
我写了一个简单的 bean,它返回一个硬编码的值,然后打印出来,我改变了这个值来测试开发工具,但它没有重新启动资源,我不得不杀死并重新启动应用程序以反映新的变化..
我怎样才能检查出什么问题?
如果需要,我可以提供控制台抓取。
请帮忙。
更新:我不知道以下内容的重要性,所以把它放在这里。
在 XML 编辑器中,hal 是红色下划线,悬停时带有以下 msg:
托管版本为 3.0.5.RELEASE 神器在 org.springframework.data:spring-data-releasetrain:Kay-SR5 中管理
在 XML 编辑器中,devtools 是红色下划线,悬停时带有以下味精:
托管版本为 2.0.0.RELEASE 工件托管在 org.springframework.boot:spring-boot-dependencies:2.0.0.RELEASE
pom.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.myoxigen.training.springboot</groupId>
<artifactId>library</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>library</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.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-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</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-devtools</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
application.properties 文件:
logging.level.org.springframework = DEBUG
management.security.enabled=false
Run Code Online (Sandbox Code Playgroud)
注意:此答案基于 Spring Boot 2(路径和属性已从版本 1 更改)。
你pom.xml在我看来很好。要获得“HAL浏览器”将工作与执行机构,你应该有首发:web,actuator,和Rest Repositories HAL Browser。我推荐Spring Initializr作为构建初始有效项目结构的好方法。
执行器的默认路径是/actuator。例如,健康处于/actuator/health。
要在 HAL 浏览器中查看执行器端点,请转到/browser/index.html#/actuator。
您可以application.properties通过设置以下内容来更改执行器路径。
management.endpoints.web.base-path=/actuator
Run Code Online (Sandbox Code Playgroud)
要运行您的服务器,请使用以下控制台命令:
./mvnw clean spring-boot:run
Run Code Online (Sandbox Code Playgroud)
如果您DevTools的项目中有,那么对类路径中文件的更改将重新启动服务器。在此处查看我关于如何利用 DevTools 的进一步评论。
以下是单个页面上的相关文档,以便于搜索:
小智 5
Add this Dependency:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
<version>3.3.5.RELEASE</version>
</dependency>`enter code here`
And then go to link:
http://localhost:8080/browser/index.html#
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4709 次 |
| 最近记录: |