在命令行上运行时,gradle bootRun通过环境变量(例如SPRING_PROFILES_ACTIVE)将弹簧配置文件传递给(对我来说)的最简单方法.
与应用程序配置不同,gradle任务的配置不提供环境变量的输入.由于虚拟机选项似乎没有被选中,我无法从IDE运行这些任务.
我知道,我可以用envvar设置启动IntelliJ,但这看起来相当麻烦.
所以我需要的是IntelliJ吊坠SPRING_PROFILES_ACTIVE=dev,testdb gradle bootRun,除非有充分的理由,否则他们就把它留了下来.
系统是linux,intellij 14.有问题的项目是使用springboot,我想从mainIntelliJ中运行到使用springloaded + bootRun和单独compileGroovy调用运行,因为IntelliJ没有完全"理解"gradle文件,因此隐藏了错误.
我有一个单独的gradle脚本,只是添加了spring-boot插件.它看起来像这样:
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url 'http://repo.spring.io/libs-release' }
}
dependencies {
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.1.8.RELEASE'
}
}
apply plugin: 'spring-boot'
Run Code Online (Sandbox Code Playgroud)
然后,在另一个项目中,它被引用如下:
apply from: '../../food-orders-online-main/spring-boot.gradle'
Run Code Online (Sandbox Code Playgroud)
当我运行构建任务时,我收到以下错误:
A problem occurred evaluating script.
> Failed to apply plugin [id 'spring-boot']
> Plugin with id 'spring-boot' not found.
Run Code Online (Sandbox Code Playgroud)
有人知道我做错了什么吗?
我想在服务器端使用Grails进行跨源通信.我找到的唯一文档就是这个
https://grails.org/plugin/cors
但这是旧版的Grails.我找到的其他文件是春天:
https://spring.io/guides/gs/rest-service-cors/
所以我添加的文件SimpleCorsFilter.groovy到init/myproject/文件夹,但我不知道如何把这个组件成resources.groovy
我正在玩spring-boot-sample-data-elastcisearch项目.我改变了pom并添加了:
SampleElasticsearchApplicationWebXml extends SpringBootServletInitializer
Run Code Online (Sandbox Code Playgroud)
运行Tomcat嵌入式.我的application.properties有
spring.data.elasticsearch.http-enabled=true
spring.data.elasticsearch.local=true
Run Code Online (Sandbox Code Playgroud)
我希望能够连接到localhost:9200以便使用elasticsearch-head或其他JS客户端.我错过了什么?谢谢,米兰
我正在将新的Grails 3.0.1应用程序导入IU 14.1.1并收到"未编制索引的远程maven存储库"的警告:

打开存储库列表并按建议单击更新似乎没有做任何事情.

根据此问题,IDEA还没有Grails 3.x支持:IDEA-136970支持Grails 3.0.
是否有解决方法或我应该禁用警告,直到官方支持发布?
我从Grails 2.4.3升级到2.4.4后,在启动Grails应用程序时出现错误.完整的错误可以在这里阅读:http://pastebin.com/UXQ34JKD
2014-10-31 16:26:32 ERROR [context.GrailsContextLoaderListener] Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Association references unmapped class: java.util.List
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested …Run Code Online (Sandbox Code Playgroud) Java的:
public final class Outer {
public static void main(String[] args) {
Inner.inner();
}
private static final class Inner {
private static void inner() {
System.out.println("inner");
outer();
}
}
private static void outer() {
System.out.println("outer");
}
}
Run Code Online (Sandbox Code Playgroud)
运行时输出:
inner
outer
Run Code Online (Sandbox Code Playgroud)
Groovy的:
public final class Outer {
static main(String[] args) {
Inner.inner()
}
static outer() {
println('outer')
}
static final class Inner {
static inner() {
println('inner')
outer()
}
}
}
Run Code Online (Sandbox Code Playgroud)
运行时输出:
$ groovy Outer
inner
Caught: groovy.lang.MissingMethodException: No signature of …Run Code Online (Sandbox Code Playgroud) 现在vaadin 7.3已经问世,它拥有非常漂亮的Valo主题.但我不知道如何将它导入我的项目?现在我使用我的自定义scss文件的默认主题.我想品尝Valo.请有人帮我如何将valo主题导入我的项目.
更重要的是,我如何选择主题样式?Valo Theme Demo有不同的主题风格,如Default,Blueprint,Dark,Metro,Flat.如何按我的意愿选择这个类别?
我是groovy的新手,刚开始探索它的元编程功能.我坚持在bean构造函数调用中添加缺少的属性.
在与FactoryBuilderSupport一起使用的类中,我想动态添加在构造函数调用期间尚未定义和提供的那些属性.这是精简版:
@Canonical
class MyClass {
def startDate
def additionalProperties = [:]
def void propertyMissing(String name, value) {
additionalProperties[name] = value
}
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我构造具有未知属性的类,则不添加proprty但是我得到了一个MissingPropertyException:
def thing = new MyClass(startDate: DateTime.now(), duration: 1234)
Run Code Online (Sandbox Code Playgroud)
属性持续时间不存在,我预计它将通过处理propertyMissing.据我所知groovy,调用tuple-constructor会导致无参数构造函数调用,然后调用groovy生成的setter.那么为什么我会得到一个MissingPropertyException?
由于我是groovy的新手,我可能缺少一些基本的AST或MOP规则.我非常感谢你的帮助.
在spring框架中,如果我将一个bean定义为范围"protoype"并且它是另一个bean的父级.子bean会自动成为原型吗?
例:
<bean id="a" class="..." scope="prototype"/>
<bean id="b" class="..." parent="a"/>
Run Code Online (Sandbox Code Playgroud)
b的范围是什么?
grails ×3
gradle ×2
grails-3.0 ×2
groovy ×2
java ×2
cors ×1
grails-2.4 ×1
groovyshell ×1
mop ×1
spring ×1
spring-boot ×1
vaadin ×1
vaadin7 ×1