Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail bean initializing when specify @Transactional on mapper interface #2

Open
kazuki43zoo opened this issue Jan 30, 2022 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@kazuki43zoo
Copy link
Member

Mapper

@Mapper
@Transactional
public interface CityMapper {

  @Insert("INSERT INTO city (name, state, country) VALUES(#{name}, #{state}, #{country})")
  @Options(useGeneratedKeys = true, keyProperty = "id")
  void insert(City city);

  @Select("SELECT id, name, state, country FROM city ")
  Collection<City> findAll();

}

Error message

...
2022-01-15 09:42:12.915 WARN 14906 --- [ main] o.s.c.support.GenericApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mybatisSpringNativeSampleApplication.MyService': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cityMapper': Post-processing of FactoryBean's singleton object failed; nested exception is com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface org.mybatis.spring.nativex.sample.simple.CityMapper, interface org.springframework.aop.SpringProxy, interface org.springframework.aop.framework.Advised, interface org.springframework.core.DecoratingProxy] not found. Generating proxy classes at runtime is not supported. Proxy classes need to be defined at image build time by specifying the list of interfaces that they implement. To define proxy classes use -H:DynamicProxyConfigurationFiles= and -H:DynamicProxyConfigurationResources= options.
2022-01-15 09:42:12.916 ERROR 14906 --- [ main] o.s.boot.SpringApplication : Application run failed
...

@kazuki43zoo kazuki43zoo added bug Something isn't working help wanted Extra attention is needed labels Jan 30, 2022
@kazuki43zoo kazuki43zoo pinned this issue Jan 30, 2022
@linghengqian
Copy link

Just curious, does the issue refer to a class in the master branch? I don't seem to see transactions to unit tests in the Example folder. I understand that the @Transactional annotation should be applied to the service layer implementation class rather than to the interface.

This was referenced May 31, 2022
@kazuki43zoo kazuki43zoo added this to the 0.1.0 milestone Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants