Browse Source

Polishing.

Remove superfluous public keyword where not required.

Original pull request #980
pull/981/head
Mark Paluch 5 years ago committed by Jens Schauder
parent
commit
f08b5cae6f
No known key found for this signature in database
GPG Key ID: 45CC872F17423DBF
  1. 40
      src/main/asciidoc/jdbc.adoc

40
src/main/asciidoc/jdbc.adoc

@ -127,7 +127,7 @@ The Spring Data JDBC repositories support can be activated by an annotation thro
class ApplicationConfig extends AbstractJdbcConfiguration { // <2> class ApplicationConfig extends AbstractJdbcConfiguration { // <2>
@Bean @Bean
public DataSource dataSource() { // <3> DataSource dataSource() { // <3>
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
return builder.setType(EmbeddedDatabaseType.HSQL).build(); return builder.setType(EmbeddedDatabaseType.HSQL).build();
@ -250,13 +250,11 @@ Custom converters can be registered, for types that are not supported by default
[source,java] [source,java]
---- ----
@Configuration @Configuration
public class DataJdbcConfiguration extends AbstractJdbcConfiguration { class DataJdbcConfiguration extends AbstractJdbcConfiguration {
@Override @Override
public JdbcCustomConversions jdbcCustomConversions() { public JdbcCustomConversions jdbcCustomConversions() {
return new JdbcCustomConversions(Collections.singletonList(TimestampTzToDateConverter.INSTANCE)); return new JdbcCustomConversions(Collections.singletonList(TimestampTzToDateConverter.INSTANCE));
} }
@ReadingConverter @ReadingConverter
@ -303,7 +301,7 @@ The following example maps the `MyEntity` class to the `CUSTOM_TABLE_NAME` table
[source,java] [source,java]
---- ----
@Table("CUSTOM_TABLE_NAME") @Table("CUSTOM_TABLE_NAME")
public class MyEntity { class MyEntity {
@Id @Id
Integer id; Integer id;
@ -322,7 +320,7 @@ The following example maps the `name` property of the `MyEntity` class to the `C
==== ====
[source,java] [source,java]
---- ----
public class MyEntity { class MyEntity {
@Id @Id
Integer id; Integer id;
@ -340,7 +338,7 @@ In the following example the corresponding table for the `MySubEntity` class has
==== ====
[source,java] [source,java]
---- ----
public class MyEntity { class MyEntity {
@Id @Id
Integer id; Integer id;
@ -348,7 +346,7 @@ public class MyEntity {
Set<MySubEntity> subEntities; Set<MySubEntity> subEntities;
} }
public class MySubEntity { class MySubEntity {
String name; String name;
} }
---- ----
@ -360,7 +358,7 @@ This additional column name may be customized with the `keyColumn` Element of th
==== ====
[source,java] [source,java]
---- ----
public class MyEntity { class MyEntity {
@Id @Id
Integer id; Integer id;
@ -368,7 +366,7 @@ public class MyEntity {
List<MySubEntity> name; List<MySubEntity> name;
} }
public class MySubEntity { class MySubEntity {
String name; String name;
} }
---- ----
@ -388,7 +386,7 @@ Opposite to this behavior `USE_EMPTY` tries to create a new instance using eithe
==== ====
[source,java] [source,java]
---- ----
public class MyEntity { class MyEntity {
@Id @Id
Integer id; Integer id;
@ -397,7 +395,7 @@ public class MyEntity {
EmbeddedEntity embeddedEntity; EmbeddedEntity embeddedEntity;
} }
public class EmbeddedEntity { class EmbeddedEntity {
String name; String name;
} }
---- ----
@ -414,7 +412,7 @@ Make use of the shortcuts `@Embedded.Nullable` & `@Embedded.Empty` for `@Embedde
[source,java] [source,java]
---- ----
public class MyEntity { class MyEntity {
@Id @Id
Integer id; Integer id;
@ -610,7 +608,7 @@ The following example shows how to use `@Query` to declare a query method:
==== ====
[source,java] [source,java]
---- ----
public interface UserRepository extends CrudRepository<User, Long> { interface UserRepository extends CrudRepository<User, Long> {
@Query("select firstName, lastName from User u where u.emailAddress = :email") @Query("select firstName, lastName from User u where u.emailAddress = :email")
User findByEmailAddress(@Param("email") String email); User findByEmailAddress(@Param("email") String email);
@ -828,7 +826,7 @@ For example, the following listener gets invoked before an aggregate gets saved:
[source,java] [source,java]
---- ----
@Bean @Bean
public ApplicationListener<BeforeSaveEvent<Object>> loggingSaves() { ApplicationListener<BeforeSaveEvent<Object>> loggingSaves() {
return event -> { return event -> {
@ -845,7 +843,7 @@ Callback methods will only get invoked for events related to the domain type and
==== ====
[source,java] [source,java]
---- ----
public class PersonLoadListener extends AbstractRelationalEventListener<Person> { class PersonLoadListener extends AbstractRelationalEventListener<Person> {
@Override @Override
protected void onAfterLoad(AfterLoadEvent<Person> personLoad) { protected void onAfterLoad(AfterLoadEvent<Person> personLoad) {
@ -937,11 +935,11 @@ If you need to tweak transaction configuration for one of the methods declared i
==== ====
[source,java] [source,java]
---- ----
public interface UserRepository extends CrudRepository<User, Long> { interface UserRepository extends CrudRepository<User, Long> {
@Override @Override
@Transactional(timeout = 10) @Transactional(timeout = 10)
public List<User> findAll(); List<User> findAll();
// Further query method declarations // Further query method declarations
} }
@ -959,7 +957,7 @@ The following example shows how to create such a facade:
[source,java] [source,java]
---- ----
@Service @Service
class UserManagementImpl implements UserManagement { public class UserManagementImpl implements UserManagement {
private final UserRepository userRepository; private final UserRepository userRepository;
private final RoleRepository roleRepository; private final RoleRepository roleRepository;
@ -999,7 +997,7 @@ To let your query methods be transactional, use `@Transactional` at the reposito
[source,java] [source,java]
---- ----
@Transactional(readOnly = true) @Transactional(readOnly = true)
public interface UserRepository extends CrudRepository<User, Long> { interface UserRepository extends CrudRepository<User, Long> {
List<User> findByLastname(String lastname); List<User> findByLastname(String lastname);
@ -1035,7 +1033,7 @@ In order to activate auditing, add `@EnableJdbcAuditing` to your configuration,
class Config { class Config {
@Bean @Bean
public AuditorAware<AuditableUser> auditorProvider() { AuditorAware<AuditableUser> auditorProvider() {
return new AuditorAwareImpl(); return new AuditorAwareImpl();
} }
} }

Loading…
Cancel
Save