Skip to content

Commit

Permalink
Use @qualifier instead of @nAmed to resolve issue
Browse files Browse the repository at this point in the history
It seems that @nAmed stopped working with Spring 6,
honestly I have no idea why.
As it works fine with @qualifier the problem seems to be on the Spring
side, so to unblock this change will go with that.
  • Loading branch information
leonard84 committed Feb 16, 2023
1 parent 5bf87c6 commit afec49e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package org.spockframework.spring.mock

import org.spockframework.spring.*
import org.spockframework.util.VersionNumber
import spock.lang.IgnoreIf
import spock.lang.Specification

import javax.inject.Named
Expand All @@ -33,7 +35,7 @@ class ComplexUsageSpec extends Specification {
@SpringBean
Service2 aService2 = Mock()

@Named("myName")
@Qualifier("myName")
@SpringBean
Service2 nService2 = Mock()

Expand Down Expand Up @@ -75,7 +77,7 @@ class ComplexConfig {
}

@Bean
Service1 service1WithNamed(@Named("myName") Service2 namedService2) {
Service1 service1WithNamed(@Qualifier("myName") Service2 namedService2) {
new Service1(namedService2)
}

Expand Down

0 comments on commit afec49e

Please sign in to comment.