小编Eri*_*rra的帖子

使用Gradle将Java工件发布到Maven Local

尝试将生成的jar安装到我的本地Maven存储库时,我遇到了问题.消息错误只显示'找不到任务'发布'

我正在使用这个Gradle脚本:

buildscript {
    ext {
        springBootVersion = '1.3.2.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'maven-publish'

jar {
    baseName = 'mongofoundry'
    version = '1.0.0'
}
sourceCompatibility = 1.7
targetCompatibility = 1.7


repositories {
    mavenCentral()
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.boot:spring-boot-starter-data-mongodb')
    testCompile('org.springframework.boot:spring-boot-starter-test') 
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java
        }
    }
}


eclipse {
    classpath {
         containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
         containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7'
    }
}

task …
Run Code Online (Sandbox Code Playgroud)

publish artifact gradle maven

38
推荐指数
4
解决办法
3万
查看次数

Spring Cloud Zuul不转发cookie

我正面临着春云Zuul代理的问题.我配置,启动和运行两个微服务.我在我的网络浏览器中有一个cookie,我使用Zuul作为API网关,当我点击Zuul来调用我的后端时,Zuul没有将我的cookie转发到我的后端,似乎Zuul忽略了发送的cookie而我的后端是无法检索这个.

你能帮我解决这个问题吗?我正在使用Spring云Brixton.RELEASE和spring boot 1.3.5

问候.

cookies spring-boot netflix-zuul spring-cloud-netflix

11
推荐指数
2
解决办法
8760
查看次数

从 Swagger API for Java REST 生成单元测试代码

我尝试使用 Swagger 测试模板,发现这是一个有趣的工具来为我的控制器生成测试文件,但它似乎只适用于 NodeJs 项目,因为 Java 平台没有类似的工具。

有人知道如何通过为 spring 启动项目使用 swagger 文件从我的控制器生成这些测试文件吗?

PD:

我曾尝试使用 RepreZen 和 SwaggerHub 等商业工具,但它们不会为我生成测试文件。

我也尝试过使用 swagger-generator jar 工具来生成那些类型的文件,但是这个工具只是为客户端生成代码,而不是为服务器生成代码。

Thx你很多!

java automated-tests swagger spring-boot swagger-2.0

8
推荐指数
2
解决办法
1万
查看次数

问题Glassfish 4没有出现glassfish-web

我正在尝试为我的Java Web应用程序项目创建描述符文件.对于我使用的这个项目:

Netbeans 8.0 &
GlassFish 4
Run Code Online (Sandbox Code Playgroud)

当我尝试创建glassfish描述符文件时.Netbeans显示在对话框窗口中,该窗口将创建一个名为sun-web.xml的文件,而不是glassfish-web.xml.

我在互联网上寻找这个,发现第一个sun-web.xml是为3岁以上的版本创建的,而版本4应该创建一个名为glassfish-web.xml的文件.

我正在按照一个人使用相同工具的教程.但是在教程中,他可以创建一个glassfish-web.xml文件.

当我单击完成按钮以创建sun-web.xml文件并弹出错误时,会出现另一个错误,并显示以下消息:

"找不到此项目的部署配置.无法正确设置部署描述符版本"

请不要有人帮我吗???

非常感谢!!

java glassfish java-ee glassfish-4

7
推荐指数
1
解决办法
1954
查看次数

无法自动连线DefaultTokenService

我在一个简单的项目中遇到一个问题,我只是试图自动连接DefaultTokenService类,但是当应用程序启动时,这引发了下一个异常:

无法自动连线栏位:私人org.springframework.security.oauth2.provider.token.DefaultTokenServices

public class SocialApplication extends WebSecurityConfigurerAdapter {

        ... 

        @Autowired
	private DefaultTokenServices defaultTokenServices;

        ...

	public static void main(String[] args) {
		SpringApplication.run(SocialApplication.class, args);
	}

        ...

}
Run Code Online (Sandbox Code Playgroud)

我正在使用spring-boot:1.3.5。

谢谢你的帮助。

**更新1-添加了Stacktrace:**

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception
 is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springfr
amework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframe
work.beans.factory.BeanCreationException: Error creating bean with name 'socialApplication': Injection of autowired dependencies failed; nested exception is …
Run Code Online (Sandbox Code Playgroud)

java spring spring-security spring-security-oauth2

5
推荐指数
1
解决办法
2153
查看次数