小编Ale*_*ith的帖子

无法解析 spring-web-reactive 的依赖项

我在 SpringBoot 应用程序中使用 Reactive 方法进行异步流处理。

我有这 6 个用于 SpringFramework 的导入

import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;
import static org.springframework.web.reactive.function.server.RequestPredicates.*;
import static org.springframework.web.reactive.function.BodyInserters.fromObject;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
Run Code Online (Sandbox Code Playgroud)

我在我的pom.xml. 但根据 Maven 中心的说法,这些似乎最后一次使用是在 2016 年。

<!-- https://mvnrepository.com/artifact/org.springframework/spring-web-reactive -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web-reactive</artifactId>
<version>5.0.0.M2</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

这是我在 Maven 构建时的错误

[ERROR] Failed to execute goal on project SpringReactive: Could not resolve dependencies for project com.ayman:SpringReactive:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at org.springframework:spring-web-reactive:jar:5.0.0.M4: Failed to read artifact descriptor for org.springframework:spring-web-reactive:jar:5.0.0.M4: Could not transfer artifact org.springframework:spring-web-reactive:pom:5.0.0.M4 from/to public …
Run Code Online (Sandbox Code Playgroud)

maven spring-boot reactive spring-webflux

5
推荐指数
1
解决办法
6794
查看次数

Image() 已经在使用 Lombok 的 Maven 构建期间在类中定义

以下代码在使用 Maven 构建时导致编译错误 ( Image() is already defined in class) @NoArgsConstructor

import lombok.Data;
import lombok.NoArgsConstructor;

// tag::code[]
@Data
@NoArgsConstructor
public class Image {

    private int id;
    private String name;

    public Image(int id, String name) {
        this.id = id;
        this.name = name;
    }
} 
Run Code Online (Sandbox Code Playgroud)

是什么导致了这个问题,我该如何解决?

编辑:龙目岛版本是 1.16.22。

java maven lombok

5
推荐指数
1
解决办法
550
查看次数

mvn spring-boot:在 Eclipse 中运行等效

我看过他们指定将 Maven 项目作为mvn spring-boot:run. 我一直在用SpringApplication.run我的方式来运行我的 SpringBoot 应用程序。

我不知道 Eclipse 中那些教程的等价物。如何mvn spring-boot:run在我的 IDE 中运行相同的命令。(我在 Windows 上使用 Eclipse)

maven spring-boot

4
推荐指数
1
解决办法
6222
查看次数

发生模板解析错误。(春季靴子+ Thymeleaf)

我有一个用于提供图像的Spring Boot。我的模型包含在ImageController.java中。ImageService包含findPage方法。

运行我的Spring Boot应用程序时,出现此错误。

2018-06-21 15:09:14.777 ERROR 26828 --- [nio-8080-exec-1] org.thymeleaf.TemplateEngine             : [THYMELEAF][http-nio-8080-exec-1] Exception processing template "index": An error happened during template parsing (template: "class path resource [templates/index.html]")

org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/index.html]")
    at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:241) ~[thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE]
    at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parseStandalone(AbstractMarkupTemplateParser.java:100) ~[thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE]
    at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:666) ~[thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE]
    at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) [thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE]
    at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) [thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE]
    at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:354) [thymeleaf-spring5-3.0.9.RELEASE.jar:3.0.9.RELEASE]
    at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:187) [thymeleaf-spring5-3.0.9.RELEASE.jar:3.0.9.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1325) [spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1069) [spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1008) [spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) [spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974) [spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866) …
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc thymeleaf

3
推荐指数
2
解决办法
2万
查看次数

Spring Boot Run failed

I am using Spring to build my application. I used Spring Initializr to build my project. I included the following dependencies:-

  1. JPA
  2. h2 (database)
  3. ThymeLeaf templating engine
  4. Spring Actuator
  5. DevTools
  6. Security

I am using IntelliJ IDEA IDE using Gradle build on Windows Machine.

NOTE:- I have not changed gradle(v4.8) build file.

Down below is the result of running SpringBootApplication:-

"C:\Program Files\Java\jdk1.8.0_171\bin\java.exe" -javaagent:C:\Users\ayman\Downloads\Software\IntelliJIdea\lib\idea_rt.jar=61199:C:\Users\E080978\Downloads\Software\IntelliJIdea\bin -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_171\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\javaws.jar;C:\Program …
Run Code Online (Sandbox Code Playgroud)

spring h2 build.gradle spring-boot

2
推荐指数
1
解决办法
980
查看次数