我是EJB新手,创建一个有趣/学习EJB的应用程序以下是代码.
@Entity
@Table(name = "PERSON", schema = "experiment")
@NamedQuery(name = "Person.fetchAllPerson" , query = "select p from Person p")
public class Person implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private Long id;
@Column(name = "name", length = 500)
private String name;
@Column(name = "age")
private Integer age;
public Long getId() {
return id;
}
// public void setId(Long id) {
// this.id = id;
// }
public String getName() { …Run Code Online (Sandbox Code Playgroud) 我有弹簧启动器产生的弹簧启动反应应用程序.它应默认使用Netty服务器,但我可以tomcat has started on port 8080在控制台中看到它.
下面是我的pom.xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
我选择了pom.xml不包含整个pom.xml的部分内容.
下面是Spring-boot主应用程序的类.
@SpringBootApplication
@EnableWebFlux
public class SpringWebFluxDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SpringWebFluxDemoApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
还有什么遗漏?我认为它应该只与Netty一起启动.
gradle 新手,面临 jenkins 管道中的问题。整个构建成功,但无法找到我的 spring 项目的可启动 jar。如果可以,请告诉我如何将 jar 从 target/lib/ 移动到 /target 文件夹。
下面是我的 build.gradle
import io.swagger.codegen.DefaultGenerator
import io.swagger.codegen.config.CodegenConfigurator
buildscript {
ext {
springBootVersion = '2.0.5.RELEASE'
jacocoWorkspaceDirectory = "/jacoco/"
}
repositories {
mavenLocal()
maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
classpath group: "io.spring.gradle", name: "dependency-management-plugin", version: "1.0.6.RELEASE"
classpath 'com.abc.sonar:abc-sonar-gradle-plugin:2.7.1.RELEASE'
classpath group: "org.unbroken-dome.gradle-plugins", name: "gradle-testsets-plugin", version: "1.4.2"
classpath("io.swagger:swagger-codegen:2.3.1")
classpath("io.swagger.core.v3:swagger-gradle-plugin:2.0.5")
}
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: "io.spring.dependency-management"
apply plugin: "org.springframework.boot"
apply plugin: …Run Code Online (Sandbox Code Playgroud) 只是在java中尝试了一些东西,发现了以下问题。
DefaultAndStaticMethodMain.java:8: error: not a statement
implementation1::sendNotification;
^
1 error
Run Code Online (Sandbox Code Playgroud)
以下是我的代码。
父接口:
public interface ParentInterface {
default void callForCompletion() {
System.out.println("<<<< Notification sending completed. >>>>");
}
}
Run Code Online (Sandbox Code Playgroud)
子界面:
public interface ChildInterface extends ParentInterface {
public abstract void sendNotification();
static String printNotificationSentMessage() {
return "Notification is sent successfully.";
}
}
Run Code Online (Sandbox Code Playgroud)
实施1:
public class Implementation1 implements ChildInterface {
@Override
public void sendNotification() {
System.out.println("Implementation --- 1");
System.out.println("Sending notification via email >>>");
}
}
Run Code Online (Sandbox Code Playgroud)
实施2:
public class Implementation2 implements ChildInterface {
@Override
public …Run Code Online (Sandbox Code Playgroud)