我正在尝试使用jHipster生成一个简单的Spring Boot应用程序来从postgresql获取postreSQL数据库中的用户列表并使用其他控制器显示它,但是当我运行它时我得到了
Liquibase could not start correctly, your database is NOT ready: java.sql.SQLException: Connection is closed
liquibase.exception.DatabaseException: java.sql.SQLException: Connection is closed
这是我的application-dev.yml
spring:
profiles:
active: dev
include: swagger
devtools:
restart:
enabled: true
livereload:
enabled: false # we use gulp + BrowserSync for livereload
jackson:
serialization.indent_output: true
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:postgresql://localhost:5432/loginApp
username: postgres
password: admin
jpa:
database-platform: io.github.jhipster.domain.util.FixedPostgreSQL82Dialect
database: POSTGRESQL
show-sql: true
properties:
hibernate.id.new_generator_mappings: true
hibernate.cache.use_second_level_cache: true
hibernate.cache.use_query_cache: false
hibernate.generate_statistics: true
hibernate.cache.region.factory_class: io.github.jhipster.config.jcache.NoDefaultJCacheRegionFactory
mail:
host: localhost
port: 25
username:
password:
messages:
cache-seconds: 1
thymeleaf:
cache: false
liquibase:
contexts: dev
jhipster:
http:
version: V_1_1 # To use HTTP/2 you will need SSL support (see above the "server.ssl" configuration)
cache: # Cache configuration
ehcache: # Ehcache configuration
time-to-live-seconds: 3600 # By default objects stay 1 hour in the cache
max-entries: 100 # Number of objects in each cache entry
# CORS is only enabled by default with the "dev" profile, so BrowserSync can access the API
cors:
allowed-origins: "*"
allowed-methods: "*"
allowed-headers: "*"
exposed-headers: "Authorization"
allow-credentials: true
max-age: 1800
security:
authentication:
jwt:
secret: my-secret-token-to-change-in-production
# Token is valid 24 hours
token-validity-in-seconds: 86400
token-validity-in-seconds-for-remember-me: 2592000
mail: # specific JHipster mail property, for standard properties see MailProperties
from: loginApp@localhost
base-url: http://127.0.0.1:8080
metrics: # DropWizard Metrics configuration, used by MetricsConfiguration
jmx.enabled: true
graphite: # Use the "graphite" Maven profile to have the Graphite dependencies
enabled: false
host: localhost
port: 2003
prefix: loginApp
prometheus: # Use the "prometheus" Maven profile to have the Prometheus dependencies
enabled: false
endpoint: /prometheusMetrics
logs: # Reports Dropwizard metrics in the logs
enabled: false
report-frequency: 60 # in seconds
logging:
logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration
enabled: false
host: localhost
port: 5000
queue-size: 512
application:
这是我的dbUser.service.ts文件
import {Injectable} from "@angular/core";
import {Http, Response, Headers, URLSearchParams, RequestOptions} from "@angular/http";
import {Observable} from "rxjs/Observable";
import {DbUser} from "./dbUser";
import {BaseService} from "../base/base.service";
@Injectable()
export class DbUserService extends BaseService{
allUsersUrl = "http://localhost:8080/user/allDbUsers";
userUrl = "http://localhost:8080/user/dbUser";
constructor(private http:Http) {
super();
}
getAllUsers() : Observable<DbUser[]>{
return this.http.get(this.allUsersUrl)
.map(this.extractData)
.catch(this.handleError);
}
createUser(): Observable<DbUser>{
let cpHeaders = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: cpHeaders });
return this.http.post(this.userUrl, DbUser, options)
.map(success => success.status)
.catch(this.handleError);
}
getArticleById(dbUserId: string): Observable<DbUser> {
let cpHeaders = new Headers({ 'Content-Type': 'application/json' });
let cpParams = new URLSearchParams();
cpParams.set('id', dbUserId);
let options = new RequestOptions({ headers: cpHeaders, params: cpParams });
return this.http.get(this.userUrl, options)
.map(this.extractData)
.catch(this.handleError);
}
}
我不认为应用程序的角度4侧是问题。我可能错了,但我已经验证了,我没有看到任何问题。
任何帮助表示赞赏!谢谢!