@@ -127,7 +127,7 @@ The Spring Data JDBC repositories support can be activated by an annotation thro
127
127
class ApplicationConfig extends AbstractJdbcConfiguration { // <2>
128
128
129
129
@Bean
130
- public DataSource dataSource() { // <3>
130
+ DataSource dataSource() { // <3>
131
131
132
132
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
133
133
return builder.setType(EmbeddedDatabaseType.HSQL).build();
@@ -250,13 +250,11 @@ Custom converters can be registered, for types that are not supported by default
250
250
[source,java]
251
251
----
252
252
@Configuration
253
- public class DataJdbcConfiguration extends AbstractJdbcConfiguration {
253
+ class DataJdbcConfiguration extends AbstractJdbcConfiguration {
254
254
255
255
@Override
256
256
public JdbcCustomConversions jdbcCustomConversions() {
257
-
258
257
return new JdbcCustomConversions(Collections.singletonList(TimestampTzToDateConverter.INSTANCE));
259
-
260
258
}
261
259
262
260
@ReadingConverter
@@ -303,7 +301,7 @@ The following example maps the `MyEntity` class to the `CUSTOM_TABLE_NAME` table
303
301
[source,java]
304
302
----
305
303
@Table("CUSTOM_TABLE_NAME")
306
- public class MyEntity {
304
+ class MyEntity {
307
305
@Id
308
306
Integer id;
309
307
@@ -322,7 +320,7 @@ The following example maps the `name` property of the `MyEntity` class to the `C
322
320
====
323
321
[source,java]
324
322
----
325
- public class MyEntity {
323
+ class MyEntity {
326
324
@Id
327
325
Integer id;
328
326
@@ -340,15 +338,15 @@ In the following example the corresponding table for the `MySubEntity` class has
340
338
====
341
339
[source,java]
342
340
----
343
- public class MyEntity {
341
+ class MyEntity {
344
342
@Id
345
343
Integer id;
346
344
347
345
@MappedCollection(idColumn = "CUSTOM_MY_ENTITY_ID_COLUMN_NAME")
348
346
Set<MySubEntity> subEntities;
349
347
}
350
348
351
- public class MySubEntity {
349
+ class MySubEntity {
352
350
String name;
353
351
}
354
352
----
@@ -360,15 +358,15 @@ This additional column name may be customized with the `keyColumn` Element of th
360
358
====
361
359
[source,java]
362
360
----
363
- public class MyEntity {
361
+ class MyEntity {
364
362
@Id
365
363
Integer id;
366
364
367
365
@MappedCollection(idColumn = "CUSTOM_COLUMN_NAME", keyColumn = "CUSTOM_KEY_COLUMN_NAME")
368
366
List<MySubEntity> name;
369
367
}
370
368
371
- public class MySubEntity {
369
+ class MySubEntity {
372
370
String name;
373
371
}
374
372
----
@@ -388,7 +386,7 @@ Opposite to this behavior `USE_EMPTY` tries to create a new instance using eithe
388
386
====
389
387
[source,java]
390
388
----
391
- public class MyEntity {
389
+ class MyEntity {
392
390
393
391
@Id
394
392
Integer id;
@@ -397,7 +395,7 @@ public class MyEntity {
397
395
EmbeddedEntity embeddedEntity;
398
396
}
399
397
400
- public class EmbeddedEntity {
398
+ class EmbeddedEntity {
401
399
String name;
402
400
}
403
401
----
@@ -414,7 +412,7 @@ Make use of the shortcuts `@Embedded.Nullable` & `@Embedded.Empty` for `@Embedde
414
412
415
413
[source,java]
416
414
----
417
- public class MyEntity {
415
+ class MyEntity {
418
416
419
417
@Id
420
418
Integer id;
@@ -610,7 +608,7 @@ The following example shows how to use `@Query` to declare a query method:
610
608
====
611
609
[source,java]
612
610
----
613
- public interface UserRepository extends CrudRepository<User, Long> {
611
+ interface UserRepository extends CrudRepository<User, Long> {
614
612
615
613
@Query("select firstName, lastName from User u where u.emailAddress = :email")
616
614
User findByEmailAddress(@Param("email") String email);
@@ -828,7 +826,7 @@ For example, the following listener gets invoked before an aggregate gets saved:
828
826
[source,java]
829
827
----
830
828
@Bean
831
- public ApplicationListener<BeforeSaveEvent<Object>> loggingSaves() {
829
+ ApplicationListener<BeforeSaveEvent<Object>> loggingSaves() {
832
830
833
831
return event -> {
834
832
@@ -845,7 +843,7 @@ Callback methods will only get invoked for events related to the domain type and
845
843
====
846
844
[source,java]
847
845
----
848
- public class PersonLoadListener extends AbstractRelationalEventListener<Person> {
846
+ class PersonLoadListener extends AbstractRelationalEventListener<Person> {
849
847
850
848
@Override
851
849
protected void onAfterLoad(AfterLoadEvent<Person> personLoad) {
@@ -937,11 +935,11 @@ If you need to tweak transaction configuration for one of the methods declared i
937
935
====
938
936
[source,java]
939
937
----
940
- public interface UserRepository extends CrudRepository<User, Long> {
938
+ interface UserRepository extends CrudRepository<User, Long> {
941
939
942
940
@Override
943
941
@Transactional(timeout = 10)
944
- public List<User> findAll();
942
+ List<User> findAll();
945
943
946
944
// Further query method declarations
947
945
}
@@ -959,7 +957,7 @@ The following example shows how to create such a facade:
959
957
[source,java]
960
958
----
961
959
@Service
962
- class UserManagementImpl implements UserManagement {
960
+ public class UserManagementImpl implements UserManagement {
963
961
964
962
private final UserRepository userRepository;
965
963
private final RoleRepository roleRepository;
@@ -999,7 +997,7 @@ To let your query methods be transactional, use `@Transactional` at the reposito
999
997
[source,java]
1000
998
----
1001
999
@Transactional(readOnly = true)
1002
- public interface UserRepository extends CrudRepository<User, Long> {
1000
+ interface UserRepository extends CrudRepository<User, Long> {
1003
1001
1004
1002
List<User> findByLastname(String lastname);
1005
1003
@@ -1035,7 +1033,7 @@ In order to activate auditing, add `@EnableJdbcAuditing` to your configuration,
1035
1033
class Config {
1036
1034
1037
1035
@Bean
1038
- public AuditorAware<AuditableUser> auditorProvider() {
1036
+ AuditorAware<AuditableUser> auditorProvider() {
1039
1037
return new AuditorAwareImpl();
1040
1038
}
1041
1039
}
0 commit comments