我创建了一个Grails 3(.1.0)应用程序。
当我执行以下步骤时:
application.yaml
替换为等效的application.groovy
http://localhost:8080
)我做错了什么?
我的application.groovy
错误了吗?
grails {
profile = "web"
codegen {
defaultPackage = "empty31"
}
}
info {
app {
name = 'empt31'
version = '0.1'
grailsVersion = '3.1.0'
}
}
spring {
groovy {
template['check-template-location'] = false
}
}
server {
contextPath = '/empty31'
}
grails {
mime {
disable {
accept {
header {
userAgents = ['Gecko', 'WebKit', 'Presto', 'Trident']
}
}
}
types {
all = '*/*'
atom = 'application/atom+xml'
css = 'text/css'
csv = 'text/csv'
form = 'application/x-www-form-urlencoded'
html = ['text/html', 'application/xhtml+xml']
js = 'text/javascript'
json = ['application/json', 'text/json']
multipartForm = 'multipart/form-data'
rss = 'application/rss+xml'
text = 'text/plain'
hal = ['application/hal+json', 'application/hal+xml']
xml = ['text/xml', 'application/xml']
}
}
urlmapping {
cache {
maxsize = 1000
}
}
controllers {
defaultScope = 'singleton'
}
converters {
encoding = 'UTF-8'
}
views {
'default' { codec = 'html' }
gsp {
encoding = 'UTF-8'
htmlcodec = 'xml'
codecs {
expression = 'html'
scriptlets = 'html'
taglib = 'none'
staticparts = 'none'
}
}
}
}
endpoints {
jmx['unique-names'] = true
}
hibernate {
cache {
queries = false
use_second_level_cache = true
use_query_cache = false
region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory'
}
}
dataSource {
pooled = true
jmxExport = true
driverClassName = "org.h2.Driver"
username = 'sa'
password = ''
}
environments {
development {
dataSource {
dbCreate = 'create-drop'
url = 'jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE'
}
}
test {
dataSource {
dbCreate = 'update'
url = 'jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE'
}
}
production {
dataSource {
dbCreate = 'update'
url = 'jdbc:h2:./prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE'
properties {
jmxEnabled = true
initialSize = 5
maxActive = 50
minIdle = 5
maxIdle = 25
maxWait = 10000
maxAge = 600000
timeBetweenEvictionRunsMillis = 5000
minEvictableIdleTimeMillis = 60000
validationQuery = 'SELECT 1'
validationQueryTimeout = 3
validationInterval = 15000
testOnBorrow = true
testWhileIdle = true
testOnReturn = false
jdbcInterceptors = 'ConnectionState'
defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
}
}
}
}
答案 0 :(得分:0)
如果您恢复到application.yml会怎样?
答案 1 :(得分:0)
看起来你的资产管道出现了问题。尝试使用grails run-app或直接运行war - 如果这可能是我们曾经通过跳过grails版本(类似于3.0.3到3.0.7)避免的资产管道错误。
您也可以尝试使用grails.assets.bundle = false禁用捆绑,看看目前是否有帮助;)
检查你的gradle.build
apply plugin: "asset-pipeline"
assets {
minifyJs = true
minifyCss = true
}
dependencies {
...
runtime "org.grails.plugins:asset-pipeline"
...
}
如果恢复到application.yml修复问题也会很有趣,因为在我们引入spring security core插件时会出现这个bug,这会带来一个开箱即用的application.groovy ......
<强> EDIT1:强> 这里是我们目前正在使用的资产版本
buildscript {
dependencies {
classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:2.0.20'
}
}
plugins {
id 'com.bertramlabs.asset-pipeline' version '2.5.0'
}