配置详情
我创建了一个带有插件的Spring启动应用程序
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>guru.springframework</groupId>
<artifactId>spring5webapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>spring5webapp</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.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-actuator</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-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
应用属性
spring.h2.console.enabled=true
spring.datasource.url=jdbc:h2:mem:AS;
spring.datasource.driverClassName=org.h2.Driver
spring.h2.console.settings.trace=true
命令行运行
@Component
public class BootStrapData implements CommandLineRunner {
private final AuthorRepository authorRepository;
private final BookRepository bookRepository;
private final PublisherRepository publisherRepository;
public BootStrapData(AuthorRepository authorRepository, BookRepository bookRepository,
PublisherRepository publisherRepository) {
this.authorRepository = authorRepository;
this.bookRepository = bookRepository;
this.publisherRepository = publisherRepository;
}
@Override
public void run(String... args) throws Exception {
Author eric = new Author("Eric", "Evans");
authorRepository.save(eric);
System.out.println("Started in bootstrap");
System.out.println("Number of Authors " + authorRepository.count());
}
}
作者epository.java
public interface AuthorRepository extends CrudRepository<Author, Long> {
}
著者java(Pojo)
package guru.springframework.spring5webapp.domain;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;
@Entity
public class Author {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String firstName;
private String lastName;
@ManyToMany(mappedBy = "authors")
private Set<Book> books = new HashSet<>();
public Author() {
}
public Author(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public Set<Book> getBooks() {
return books;
}
public void setBooks(Set<Book> books) {
this.books = books;
}
@Override
public String toString() {
return "Author{" +
"id=" + id +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", books=" + books +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Author author = (Author) o;
return id != null ? id.equals(author.id) : author.id == null;
}
@Override
public int hashCode() {
return id != null ? id.hashCode() : 0;
}
}
当我启动应用程序并转到http://localhost:8080/h2-console时,我看到一个jdbc: h2:~/test的JDBC URL,而不是jdbc: h2: mem: AS。在控制台中登录我看不到作者表。
我在stackoverflow中看到了以下帖子的内容,但没有用
我的github项目就在这里,它与Pojo有更多的交互,项目中的错误是什么?
正如用户g00glen00b在评论中提到的,必须在H2控制台中显式输入URL。
在phpinfo中有在php -m中没有 先确认CLI模式下是否有,命令行输入php --ri swoole 如果输出了Swoole的扩展信息就说明你安装成功了! 99.999%的人在此步成功就可以直接使用swoole了 不需要管php -m或者phpinfo网页打印出来是否有swoole 因为Swoole是运行在cli模式下的,在传统的fpm模式下功能十分有限 fpm模式下任何异步/协程等主要功
我遵循本教程安装Hadoop。不幸的是,当我运行start all时。sh脚本-控制台上打印了以下错误: 当我执行JPS命令时,抛出了以下错误 我是hadoop新手,请给我指一篇文章,这篇文章将帮助我安装hadoop而不会出现问题 或者,如果可能(更可取)解决所面临的问题,请让我知道出现了什么问题以及如何解决?
如果Sphinx构建失败,请您按照以下步骤进行: 确认您的DBMS的头文件和库文件都正确安装了(例如,检查mysql-devel包已经安装) 报告Sphinx的版本和配置文件(别忘了删除数据库连接密码),MySQL(或PostgreSQL)配置文件信息,gcc版本,操作系统版本和CPU类型(例如x86、x86-64、PowerPC等): mysql_config gcc --version una
Cakephp是我的第一个PHP框架。我按照文档/安装中的说明进行操作。看起来一切都是正确的,但当我尝试运行时,我出现了错误: 警告:require(/var/www/html/caketest/vendor/autoload.php):无法打开流:第23行的/var/www/html/caketest/config/bootstrap.php中没有此类文件或目录 致命错误:require():无
我在运行StartSonar.bat时面临以下问题: -->包装器作为启动JVM的控制台启动...Wrapper(版本3.2.3)http://Wrapper.tanukisoftware.org版权所有1999-2006 Tanuki Software,Inc.保留所有权利。
请大佬指教,我pnpm安装的包,node_modules 里也看到了,但是import还是未导入,还是红色的 这个是vue3打印包的安装