- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的简单 Spring Boot 应用程序有问题。它没有开始。我正在使用 IntelliJ Idea Community Edition 和 Tomcat v.8.5。我不知道问题出在哪里。这是一个日志:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.6.RELEASE)
2017-08-17 21:59:02.519 INFO 13152 --- [ main] com.project.ToDoAppApplication : Starting ToDoAppApplication on DESKTOP-8ISPJ4U with PID 13152 (D:\Intellij-workspace\ToDoApp\to-do-app\target\classes started by user in D:\Intellij-workspace\ToDoApp\to-do-app)
2017-08-17 21:59:02.533 INFO 13152 --- [ main] com.project.ToDoAppApplication : No active profile set, falling back to default profiles: default
2017-08-17 21:59:02.717 INFO 13152 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5e25a92e: startup date [Thu Aug 17 21:59:02 CEST 2017]; root of context hierarchy
2017-08-17 21:59:03.970 WARN 13152 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.project.ToDoAppApplication]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration
2017-08-17 21:59:03.979 ERROR 13152 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5e25a92e: startup date [Thu Aug 17 21:59:02 CEST 2017]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:414) [spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) [spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.destroySingletons(FactoryBeanRegistrySupport.java:230) [spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) [spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030) [spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:556) [spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at com.project.ToDoAppApplication.main(ToDoAppApplication.java:30) [classes/:na]
2017-08-17 21:59:04.045 ERROR 13152 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.project.ToDoAppApplication]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:616) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:299) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:198) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:167) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:308) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:228) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:270) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at com.project.ToDoAppApplication.main(ToDoAppApplication.java:30) [classes/:na]
Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration
at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:163) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.retrieveBeanMethodMetadata(ConfigurationClassParser.java:380) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:314) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:606) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
... 17 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/hateoas/mvc/UriComponentsContributor
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_144]
at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_144]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_144]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[na:1.8.0_144]
at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_144]
at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[na:1.8.0_144]
at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[na:1.8.0_144]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_144]
at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[na:1.8.0_144]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_144]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_144]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_144]
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_144]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_144]
at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_144]
at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:152) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]
... 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.hateoas.mvc.UriComponentsContributor
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_144]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_144]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_144]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_144]
... 37 common frames omitted
Process finished with exit code 1
我的 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.project</groupId>
<artifactId>to-do-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>to-do-app</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.lyncode</groupId>
<artifactId>jtwig-spring</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Spring Boot 应用的主类:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Import;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
@Import(RepositoryRestMvcConfiguration.class)
public class ToDoAppApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(ToDoAppApplication.class, args);
}
}
此外,在编译开始时,它会显示此消息:
Warning: java: unknown enum constant org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType.HAL
reason: class file for org.springframework.hateoas.config.EnableHypermediaSupport$HypermediaType not found
我做错了什么?
最佳答案
出现问题是因为spring-hateoas
依赖项缺少到你的项目pom.xml
中,你需要将spring-hateoas
依赖项添加到你 pom.xml
。并更新和重建您的项目并运行它。
你可以使用下面的依赖:
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
<version>0.23.0.RELEASE</version>
</dependency>
关于java - 找不到 org.springframework.hateoas.config.EnableHypermediaSupport$HypermediaType 的类文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45744337/
使用很棒的 HATEOAS 链接功能我正在尝试输出模板化的 url 以突出显示用户可用的过滤器参数 示例 Controller 方法 @RequestMapping(value = "/persons
我正在使用 spring-hateoas:0.18.0.RELEASE 与 spring-boot:1.2.5.RELEASE 为了调用我的 Web 服务并通过 HAL 链接,我正在使用 特拉弗森客户
我使用 Spring HATEOAS 在我的应用程序中创建 REST HATEOAS API。到目前为止它运行良好,但当涉及到嵌套资源时我陷入困境。将此类层次结构映射到 REST HATEOAS 资源
我想弄清楚如何使用 templated: true 建立 HAL 链接.如果我使用 BasicLinkBuilder.linkToCurrentMapping().slash("api/public/
我们使用 HATEOAS 取得了很好的效果,但是我们一直在关注性能,并且从链接的构建中得到了非常糟糕的结果,即看起来像这样的代码 resource.add(linkTo(methodOn(SomeCo
我有一个带有请求参数的方法,我正在尝试从另一个资源链接到这个方法。我希望链接是这样的: "rel":{ "href":".../resources{?param}", "templated":
我想链接到具有以下签名的方法: public SomeResponse getSomeObjects(@RequestParam(value = "foo", defaultValue = "bar"
我正在构建一个REST API。我有一个由bean组成的域模型,无法扩展ResourceSupport。使用Spring-HATEOAS将它们公开为资源的最佳方法是什么? 如果不可能,在bean生成的
我有这个问题已经在我的脑海里盘旋了一段时间。让我们假设我们已经在不同的层上构建了我们的项目,后端和前端。所以,从前端,我们想要一个客户,它来自 hal+json格式: GET /customers/1
我有一个关于 Spring HATEOAS 的表示模型处理器的问题。我们正在尝试在将模型序列化给客户端之前对其进行处理。我们的用例是丰富 imageUrl领域UserModel对象在运行时,因为我们必
想象一下,我有一个完全实现的REST API,它也提供了HATEOAS。 假设我浏览了根目录,除了自我链接之外,还返回了其他两个链接(例如,一个用于/users和一个用于/orders)。据我所知,H
据说在定义良好的 RESTful 系统中,客户端只需要知道根 URI 或几个众所周知的 URI,客户端将通过这些初始 URI 发现所有其他链接。我确实理解这种方法的好处(解耦客户端),但对我来说不利的
遵循 HATEOAS 原则,每个状态都应该是超链接的,对改变资源状态的链接进行建模的最佳方法是什么? 让我们以订单为例: { id : 12, state: 'pending', .
我试图对 HATEOAS 有一个清晰、简洁的理解,而且我绝不是 WRT REST 专家。 (我想我明白了,感谢这个 http://www.looah.com/source/view/2284 )。 有
我有理由相信我了解 HATEOAS 设计的服务器端 - 在响应中返回状态 URL - 但我对如何设计客户端来接受这些感到有点困惑。 例如,我们在//somehost.com/resource/1 访问
我正在阅读有关 spring-hateoas 的内容,看起来 1.0 有很多变化。我想切换到 1.0 但是我的 pom.xml 正在引入 0.25.2。 我试过用 org
我正在努力了解 HATEOAS。 让我们通过一个例子来工作。客户端将浏览器加载到 getemails.com。为简单起见,让我们假设对 getemails.com 的调用访问了服务器并返回一个电子邮件
我有 Spring Data Rest 和 Hateoas 作为我的支持。它在代理后面。 后端网址:backend.com 代理网址:proxy.com 当我查询代理网址时,例如http://prox
我可以有一些 HATEOAS 的示例/典型用例吗? ?我同意它可以是一个非常强大的概念,提供了很大的灵活性,但我不确定如何正确地从 HATEOAS 中受益。如果您可以分享您的经验/用例,那就太好了。
HATEOAS(作为应用程序状态引擎的超媒体)建议是否暗示查询字符串不是 RESTful? 编辑:下面建议查询字符串可能与状态没有太大关系,因此这个问题令人费解。我建议 URI 具有查询字符串没有意义
我是一名优秀的程序员,十分优秀!