小编Arn*_*aud的帖子

Spring oauth2中的StackOverflowError,带有自定义ClientDetailsS​​ervice

我自己实现了ClientDetailsS​​ervice:

@Service
public class JpaClientDetailsService implements ClientDetailsService {
    @Autowired
    private ClientRepository clientRepositoy;

    @Override
    public ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException {
        ClientDetails client = clientRepositoy.findOne(clientId);
        if (client == null) {
            throw new ClientRegistrationException(String.format("Client with id %s not found", clientId));
        }
        return client;
    }
}
Run Code Online (Sandbox Code Playgroud)

ClientRepository是标准的JpaRepository.

我像这样配置了AuthorizationServerConfigurerAdapter:

@Configuration
@EnableAuthorizationServer
@EnableResourceServer
public class OAuth2ServerConfig extends AuthorizationServerConfigurerAdapter {
    @Autowired
    private AuthenticationManager authenticationManager;

    @Autowired
    private ClientDetailsService clientDetailsService;

    @Override
    public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
        endpoints.authenticationManager(authenticationManager);
    }

    @Override
    public void configure(ClientDetailsServiceConfigurer clients) throws Exception { …
Run Code Online (Sandbox Code Playgroud)

stack-overflow spring-security-oauth2

12
推荐指数
2
解决办法
4115
查看次数

在复制依赖项之前删除旧工件版本

我使用maven-dependency-plugin将当前工件复制到自定义目录中:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.8</version>
    <executions>
        <execution>
            <id>copy-to-dsf-server</id>
            <phase>package</phase>
            <goals>
                <goal>copy</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>${project.artifactId}</artifactId>
                        <version>${project.version}</version>
                    </artifactItem>
                </artifactItems>
                <outputDirectory>${tomcat.dsf.dir}/lib/pacifisc</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

但是当工件版本发生变化时,我将同一个jar的两个版本放入目标目录中.如何删除旧版本?

此致,Arnaud

maven-dependency-plugin

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