我的Spring文件中有错误'授权服务器定制发放。 xml',关于你不在类org.springframework.security.oauth2.provider.endpoint.TokenEndpoint中的setter,它继承或是org.springframework.security.oauth2.provider.endpoint.AbstractEndpoint的子。
这是我的文件XML authorization-server-custom-grant.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:oauth2="http://www.springframework.org/schema/security/oauth2"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd
http://www.springframework.org/schema/security/spring-security-oauth2.xsd">
<bean id="tokenGranter" class="org.springframework.security.oauth2.config.xml.AuthorizationServerCustomGrantParserTests.CustomTestTokenGranter" />
<oauth2:authorization-server client-details-service-ref="clientDetails">
<oauth2:authorization-code />
<oauth2:custom-grant token-granter-ref="tokenGranter" />
</oauth2:authorization-server>
<oauth2:client-details-service id="clientDetails">
<oauth2:client client-id="foo" authorized-grant-types="password"/>
</oauth2:client-details-service>
</beans>
eclipse显示此错误
Multiple annotations found at this line:
- No setter found for property 'oAuth2RequestFactory' in class 'org.springframework.security.oauth2.provider.endpoint.TokenEndpoint'
- No setter found for property 'oAuth2RequestValidator' in class 'org.springframework.security.oauth2.provider.endpoint.TokenEndpoint'
- No setter found for property 'oAuth2RequestFactory' in class 'org.springframework.security.oauth2.provider.endpoint.AuthorizationEndpoint'
- No setter found for property 'oAuth2RequestValidator' in class 'org.springframework.security.oauth2.provider.endpoint.AuthorizationEndpoint'
这是我的文件pom.xml:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth-parent</artifactId>
<version>2.0.8.BUILD-SNAPSHOT</version>
</parent>
<artifactId>spring-security-oauth2</artifactId>
<name>OAuth2 for Spring Security</name>
<description>Module for providing OAuth2 support to Spring Security</description>
<properties>
<jackson1.version>1.9.13</jackson1.version>
<jackson2.version>2.3.2</jackson2.version>
<spring.security.jwt.version>1.0.2.RELEASE</spring.security.jwt.version>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>site</phase>
<configuration>
<tasks>
<mkdir dir="${project.reporting.outputDirectory}/schema" />
<copy todir="${project.reporting.outputDirectory}/schema">
<fileset dir="src/main/resources">
<include name="**/*.xsd" />
</fileset>
<mapper type="flatten" />
</copy>
<copy file="${project.reporting.outputDirectory}/schema/spring-security-oauth2-2.0.xsd" tofile="${project.reporting.outputDirectory}/schema/spring-security-oauth2.xsd" />
<zip destfile="${project.reporting.outputDirectory}/sparklr2.zip">
<zipfileset dir="../samples/oauth2/sparklr" includes="pom.xml src/**" prefix="sparklr" />
</zip>
<zip destfile="${project.reporting.outputDirectory}/tonr2.zip">
<zipfileset dir="../samples/oauth2/tonr" includes="pom.xml src/**" prefix="tonr" />
</zip>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<!-- In case we test with Spring 4 -->
<version>3.0.1</version>
<optional>true</optional>
</dependency>
<dependency>
<!--for the annotations. -->
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<!--for the annotations. -->
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<!--for the annotations. -->
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>3.2.1.RELEASE</version>
</dependency>
<dependency>
<!--for the annotations. -->
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson1.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.5.0.RELEASE</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson2.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson2.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.3</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.5.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.5.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb-j5</artifactId>
<version>2.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.orange.redis-embedded</groupId>
<artifactId>embedded-redis</artifactId>
<version>0.6</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
</project>
答案 0 :(得分:2)
打开java源文件(出现在错误消息中),找到该字段的setter方法,删除它并使用eclipse菜单重新生成它:Source-&gt;生成Getters和Setter。
看起来seter方法的签名无法被eclipse识别。
答案 1 :(得分:1)
从菜单栏中清理并构建项目。