Skip to content

Commit de0efe1

Browse files
committed
add licence and author attribution
1 parent 72183d6 commit de0efe1

File tree

10 files changed

+150
-4
lines changed

10 files changed

+150
-4
lines changed

jdbc/howto/multiple-datasources/src/main/java/example/springdata/jdbc/howto/multipledatasources/EvilEmpire.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright 2013-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package example.springdata.jdbc.howto.multipledatasources;
217

318
import example.springdata.jdbc.howto.multipledatasources.minion.Minion;
@@ -7,6 +22,11 @@
722

823
import java.util.List;
924

25+
/**
26+
* Sample `Service` that uses both Spring Data JDBC Repositories
27+
*
28+
* @author Daniel Frey
29+
*/
1030
@Component
1131
public class EvilEmpire {
1232

jdbc/howto/multiple-datasources/src/main/java/example/springdata/jdbc/howto/multipledatasources/MultipleDataSourceApplication.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
1+
/*
2+
* Copyright 2013-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package example.springdata.jdbc.howto.multipledatasources;
217

318
import org.springframework.boot.SpringApplication;
419
import org.springframework.boot.autoconfigure.SpringBootApplication;
520

21+
/**
22+
* @author Daniel Frey
23+
*/
624
@SpringBootApplication
725
class MultipleDataSourceApplication {
826

jdbc/howto/multiple-datasources/src/main/java/example/springdata/jdbc/howto/multipledatasources/configuration/DataSourceConfiguration.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright 2013-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package example.springdata.jdbc.howto.multipledatasources.configuration;
217

318
import org.springframework.beans.factory.annotation.Qualifier;
@@ -27,6 +42,17 @@
2742
import javax.sql.DataSource;
2843
import java.util.Optional;
2944

45+
/**
46+
* Multiple DataSource Configuration
47+
*
48+
* Sets up <code>DataSource</code>, <codd>NamedParameterJdbcOperations</codd>, and <code>TransactionManager</code>
49+
* for each Spring Data JDBC Repository.
50+
*
51+
* The second configuration also sets up the required components for Spring Data JDBC without using explicit
52+
* AutoConfiguration.
53+
*
54+
* @author Daniel Frey
55+
*/
3056
@Configuration
3157
public class DataSourceConfiguration {
3258

jdbc/howto/multiple-datasources/src/main/java/example/springdata/jdbc/howto/multipledatasources/configuration/JdbcConfiguration.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
1+
/*
2+
* Copyright 2013-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package example.springdata.jdbc.howto.multipledatasources.configuration;
217

318
import org.springframework.context.annotation.Configuration;
419
import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories;
520

21+
/**
22+
* Configures the Spring Data JDBC Repositories with explicit callouts to `jdbcOperationsRef`
23+
* and `transactionManagerRef`
24+
*
25+
* @see <code>DataSourceConfiguration.java</code>
26+
*
27+
* @author Daniel Frey
28+
*/
629
@Configuration
730
public class JdbcConfiguration {
831

jdbc/howto/multiple-datasources/src/main/java/example/springdata/jdbc/howto/multipledatasources/minion/Minion.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021 the original author or authors.
2+
* Copyright 2013-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,10 +13,19 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package example.springdata.jdbc.howto.multipledatasources.minion;
1718

1819
import org.springframework.data.annotation.Id;
1920

21+
/**
22+
*
23+
* @param id
24+
* @param name
25+
* @param evilMaster
26+
*
27+
* @author Daniel Frey
28+
*/
2029
public record Minion(
2130

2231
@Id

jdbc/howto/multiple-datasources/src/main/java/example/springdata/jdbc/howto/multipledatasources/minion/MinionRepository.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021 the original author or authors.
2+
* Copyright 2013-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package example.springdata.jdbc.howto.multipledatasources.minion;
1718

1819
import org.springframework.data.jdbc.repository.query.Query;
@@ -21,6 +22,9 @@
2122

2223
import java.util.Collection;
2324

25+
/**
26+
* @author Daniel Frey
27+
*/
2428
public interface MinionRepository extends CrudRepository<Minion, Long> {
2529

2630
@Query( "SELECT * FROM MINION WHERE EVIL_MASTER = :id" )

jdbc/howto/multiple-datasources/src/main/java/example/springdata/jdbc/howto/multipledatasources/person/Person.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021 the original author or authors.
2+
* Copyright 2013-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,6 +17,13 @@
1717

1818
import org.springframework.data.annotation.Id;
1919

20+
/**
21+
*
22+
* @param id
23+
* @param name
24+
*
25+
* @author Daniel Frey
26+
*/
2027
public record Person(
2128

2229
@Id

jdbc/howto/multiple-datasources/src/main/java/example/springdata/jdbc/howto/multipledatasources/person/PersonRepository.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021 the original author or authors.
2+
* Copyright 2013-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,6 +17,9 @@
1717

1818
import org.springframework.data.repository.CrudRepository;
1919

20+
/**
21+
* @author Daniel Frey
22+
*/
2023
public interface PersonRepository extends CrudRepository<Person, Long> {
2124

2225
}

jdbc/howto/multiple-datasources/src/test/java/example/springdata/jdbc/howto/multipledatasources/EvilEmpireTests.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright 2013-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package example.springdata.jdbc.howto.multipledatasources;
217

318
import org.junit.jupiter.api.Test;
@@ -7,6 +22,9 @@
722
import static org.assertj.core.api.Assertions.assertThat;
823
import static org.assertj.core.api.Assertions.assertThatThrownBy;
924

25+
/**
26+
* @author Daniel Frey
27+
*/
1028
@SpringBootTest
1129
public class EvilEmpireTests {
1230

jdbc/howto/multiple-datasources/src/test/java/example/springdata/jdbc/howto/multipledatasources/MultipleDataSourceApplicationTests.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
1+
/*
2+
* Copyright 2013-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package example.springdata.jdbc.howto.multipledatasources;
217

318
import org.junit.jupiter.api.Test;
419
import org.springframework.boot.test.context.SpringBootTest;
520

21+
/**
22+
* @author Daniel Frey
23+
*/
624
@SpringBootTest
725
public class MultipleDataSourceApplicationTests {
826

0 commit comments

Comments
 (0)