Details

      Description

      spring data is now requires java 1.8. It would be nice to have Instant and probably other java 8 simple types registered by default in SimpleTypeHolder.

      Currently one can register it by itself but its not clear what is the right place to do it since this is a good old singleton shared across all Mapping Contexts.

      My use case is elasticsearch document with Instant field. I have customized the jackson object mapper used to support Instant but on java 9+ with --illegal-access=deny My app fails to start.

      here is the relevant stack trace

      Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private java.time.Instant(long,int) accessible: module java.base does not "opens java.time" to unnamed module @22ff7899
      	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337) ~[?:?]
      	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281) ~[?:?]
      	at java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:192) ~[?:?]
      	at java.lang.reflect.Constructor.setAccessible(Constructor.java:185) ~[?:?]
      	at org.springframework.util.ReflectionUtils.makeAccessible(ReflectionUtils.java:488) ~[spring-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
      	at org.springframework.data.mapping.PreferredConstructor.<init>(PreferredConstructor.java:69) ~[spring-data-commons-2.0.0.RELEASE.jar:2.0.0.RELEASE]
      	at org.springframework.data.mapping.model.PreferredConstructorDiscoverer$Discoverers.buildPreferredConstructor(PreferredConstructorDiscoverer.java:228) ~[spring-data-commons-2.0.0.RELEASE.jar:2.0.0.RELEASE]
      	at org.springframework.data.mapping.model.PreferredConstructorDiscoverer$Discoverers.access$200(PreferredConstructorDiscoverer.java:89) ~[spring-data-commons-2.0.0.RELEASE.jar:2.0.0.RELEASE]
      	at org.springframework.data.mapping.model.PreferredConstructorDiscoverer$Discoverers$1.discover(PreferredConstructorDiscoverer.java:112) ~[spring-data-commons-2.0.0.RELEASE.jar:2.0.0.RELEASE]
      	at org.springframework.data.mapping.model.PreferredConstructorDiscoverer.discover(PreferredConstructorDiscoverer.java:77) ~[spring-data-commons-2.0.0.RELEASE.jar:2.0.0.RELEASE]
      	at org.springframework.data.mapping.model.BasicPersistentEntity.<init>(BasicPersistentEntity.java:93) ~[spring-data-commons-2.0.0.RELEASE.jar:2.0.0.RELEASE]
      	at org.springframework.data.mapping.model.BasicPersistentEntity.<init>(BasicPersistentEntity.java:74) ~[spring-data-commons-2.0.0.RELEASE.jar:2.0.0.RELEASE]
      

        Attachments

          Activity

            People

            • Assignee:
              mp911de Mark Paluch
              Reporter:
              tsachev Vladimir Tsanev
              Last updater:
              Mark Paluch
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: