spring-native
spring-native copied to clipboard
Fail bean initializing when specify @Transactional on mapper interface
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=
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.