Skip to content

Commit

Permalink
Merge pull request #980 from hazendaz/master
Browse files Browse the repository at this point in the history
Build updates - use standard directory layout
  • Loading branch information
hazendaz authored Aug 11, 2024
2 parents 88b887a + 3f0679a commit c0d7cc1
Show file tree
Hide file tree
Showing 69 changed files with 77 additions and 95 deletions.
49 changes: 16 additions & 33 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
<!-- Maven compiler options -->
<java.version>17</java.version>
<java.release.version>17</java.release.version>
<java.test.version>17</java.test.version>
<java.test.release.version>17</java.test.release.version>

<derby.version>10.17.1.0</derby.version>
<mybatis.version>3.5.16</mybatis.version>
Expand Down Expand Up @@ -155,6 +157,14 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.22.1</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>

<!-- Test dependencies -->

<dependency>
Expand Down Expand Up @@ -276,10 +286,6 @@
<groupId>nekohtml</groupId>
<artifactId>nekohtml</artifactId>
</exclusion>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -323,12 +329,6 @@
<version>6.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.22.1</version>
<optional>true</optional>
</dependency>

<dependency>
<groupId>net.bytebuddy</groupId>
Expand Down Expand Up @@ -402,20 +402,12 @@
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>${project.build.testSourceDirectory}</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<systemPropertyVariables>
<property>
<name>derby.stream.error.file</name>
<value>${project.build.directory}/derby.log</value>
Expand All @@ -424,7 +416,7 @@
<name>com.atomikos.icatch.log_base_dir</name>
<value>${project.build.directory}</value>
</property>
</systemProperties>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
Expand All @@ -442,7 +434,7 @@
<outputDirectory>${project.build.directory}/site-src</outputDirectory>
<resources>
<resource>
<directory>src/site</directory>
<directory>${project.basedir}/src/site</directory>
<filtering>true</filtering>
</resource>
</resources>
Expand Down Expand Up @@ -474,23 +466,14 @@
</plugins>
</build>

<profiles>
<profile>
<id>pre16</id>
<activation>
<jdk>(,16)</jdk>
</activation>
<properties>
<derby.version>10.15.2.0</derby.version>
</properties>
</profile>
<profiles>
<profile>
<id>17</id>
<activation>
<jdk>[17,)</jdk>
</activation>
<properties>
<derby.version>10.16.1.1</derby.version>
<derby.version>10.16.1.1</derby.version>
</properties>
</profile>
<profile>
Expand All @@ -499,7 +482,7 @@
<jdk>[19,)</jdk>
</activation>
<properties>
<derby.version>10.17.1.0</derby.version>
<derby.version>10.17.1.0</derby.version>
</properties>
</profile>
</profiles>
Expand Down
2 changes: 1 addition & 1 deletion src/site/es/markdown/mappers.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Si se indican ambas se añadirán todos los mappers que cumplan **cualquier** cr

Los mappers descubiertos serán nombrados usando la estratégia de nombres por defecto de Spring para los componentes autodetectados (see [the Spring reference document(Core Technologies -Naming autodetected components-](https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#beans-scanning-name-generator)).
Es decir, si no se encuentra ninguna anotación, se usará el nombre no cualificado sin capitalizar del mapper. Pero si se encuentra una anotación `@Component` o JSR-330 `@Named` se obtendrá el nombre de dicha anotación.
Fíjate que puedes usar como valor de la `annotation` el valor `org.springframework.stereotype.Component`, `javax.inject.Named` (if you have JSE 6) o una anotación propia (que debe ser a su vez anotada) de forma que la anotación hará las veces de localizador y de proveedor de nombre.
Fíjate que puedes usar como valor de la `annotation` el valor `org.springframework.stereotype.Component`, `jakarta.inject.Named` (if you have Jakarta EE) o una anotación propia (que debe ser a su vez anotada) de forma que la anotación hará las veces de localizador y de proveedor de nombre.

<span class="label important">NOTE</span>
`<context:component-scan/>` no puede encontrar y registrar mappers. Los mappers son interfaces y, para poderlos registrar en Spring, el scanner deben conocer cómo crear un `MapperFactoryBean` para cada interfaz encontrado.
Expand Down
2 changes: 1 addition & 1 deletion src/site/ja/markdown/mappers.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ XML 設定の例:

検出された Mapper は、Spring の自動検出コンポーネントに対するデフォルト命名規則によって Bean 名が決められます[the Spring reference document(Core Technologies -Naming autodetected components-](https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#beans-scanning-name-generator) を参照してください。
アノテーションによる指定がない場合はクラス名の先頭を小文字にした文字列が Bean 名となりますが、`@Component` あるいは JSR-330 の `@Named` アノテーションを使って Bean 名を明示的に指定することもできます。
先に説明した `annotation` 属性で `org.springframework.stereotype.Component``javax.inject.Named`Java 6 以降を利用している場合のみ)を指定すれば、検出時のマーカーと Bean 名の指定を1つのアノテーションで兼ねることができます。
先に説明した `annotation` 属性で `org.springframework.stereotype.Component``jakarta.inject.Named`Jakarta EE 以降を利用している場合のみ)を指定すれば、検出時のマーカーと Bean 名の指定を1つのアノテーションで兼ねることができます。
同じ目的で独自に定義したアノテーションを使うこともできますが、このアノテーション自体に `@Component``@Named` を付加しておく必要があります。

<span class="label important">NOTE</span>
Expand Down
2 changes: 1 addition & 1 deletion src/site/ko/markdown/mappers.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ The `default-scope` apply to the mapper bean(`MapperFactoryBean`) when scope of

발견된 매퍼는 자동검색된 컴포넌트를 위한 스프링의 디폴트 명명규칙 전략(see [the Spring reference document(Core Technologies -Naming autodetected components-)](https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#beans-scanning-name-generator) 을 사용해서 빈이름이 명명된다.
빈 이름을 정하는 애노테이션이 없다면 매퍼의 이름에서 첫글자를 소문자로 변환한 형태로 빈 이름을 사용할 것이다. `@Component` 나 JSR-330의 `@Named` 애노테이션이 있다면 애노테이션에 정의한 이름을 그대로 사용할 것이다.
`annotation` 프로퍼티를 `org.springframework.stereotype.Component`, `javax.inject.Named`(자바SE 1.6을 사용한다면) 또는 개발자가 스스로 작성한 애노테이션으로 셋팅할 수 있다.
`annotation` 프로퍼티를 `org.springframework.stereotype.Component`, `jakarta.inject.Named`(Jakarta EE을 사용한다면) 또는 개발자가 스스로 작성한 애노테이션으로 셋팅할 수 있다.
그러면 애노테이션은 마커와 이름을 제공하는 역할로 동작할 것이다.

<span class="label important">중요</span>
Expand Down
2 changes: 1 addition & 1 deletion src/site/markdown/mappers.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ By default, these two properties are null, so all interfaces in the given base p

Discovered mappers will be named using Spring default naming strategy for autodetected components (see [the Spring reference document(Core Technologies -Naming autodetected components-)](https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#beans-scanning-name-generator)).
That is, if no annotation is found, it will use the uncapitalized non-qualified class name of the mapper. But if either a `@Component` or a JSR-330 `@Named` annotation is found it will get the name from the annotation.
Notice that you can set the `annotation` attribute to `org.springframework.stereotype.Component`, `javax.inject.Named` (if you have JSE 6) or to your own annotation (that must be itself annotated) so the annotation will work both as a marker and as a name provider.
Notice that you can set the `annotation` attribute to `org.springframework.stereotype.Component`, `jakarta.inject.Named` (if you have JakartaEE) or to your own annotation (that must be itself annotated) so the annotation will work both as a marker and as a name provider.

<span class="label important">NOTE</span>
`<context:component-scan/>` won't be able to scan and register mappers. Mappers are interfaces and, in order to register them to Spring, the scanner must know how to create a `MapperFactoryBean` for each interface it finds.
Expand Down
2 changes: 1 addition & 1 deletion src/site/zh_CN/markdown/mappers.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public interface GoodsMapper {

被发现的映射器会按照 Spring 对自动发现组件的默认命名策略进行命名(参考 [the Spring reference document(Core Technologies -Naming autodetected components-)](https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#beans-scanning-name-generator) )。
也就是说,如果没有使用注解显式指定名称,将会使用映射器的首字母小写非全限定类名作为名称。但如果发现映射器具有 `@Component` 或 JSR-330 标准中 `@Named` 注解,会使用注解中的名称作为名称。
提醒一下,你可以设置 `annotation` 属性为你自定义的注解,然后在你的注解上设置 `org.springframework.stereotype.Component``javax.inject.Named`(需要使用 Java SE 6 以上)注解,这样你的注解既可以作为标记,也可以作为一个名字提供器来使用了。
提醒一下,你可以设置 `annotation` 属性为你自定义的注解,然后在你的注解上设置 `org.springframework.stereotype.Component``jakarta.inject.Named`(需要使用 Jakarta EE 以上)注解,这样你的注解既可以作为标记,也可以作为一个名字提供器来使用了。

<span class="label important">提示</span>
`<context:component-scan/>` 无法发现并注册映射器。映射器的本质是接口,为了将它们注册到 Spring 中,发现器必须知道如何为找到的每个接口创建一个 `MapperFactoryBean`
Expand Down
11 changes: 5 additions & 6 deletions src/test/java/org/mybatis/spring/SqlSessionFactoryBeanTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2023 the original author or authors.
* Copyright 2010-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -67,6 +67,7 @@
import org.mybatis.spring.type.SuperType;
import org.mybatis.spring.type.TypeHandlerFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

class SqlSessionFactoryBeanTest {

Expand Down Expand Up @@ -274,8 +275,7 @@ void testNullConfigLocation() throws Exception {
void testSetConfigLocation() throws Exception {
setupFactoryBean();

factoryBean
.setConfigLocation(new org.springframework.core.io.ClassPathResource("org/mybatis/spring/mybatis-config.xml"));
factoryBean.setConfigLocation(new ClassPathResource("org/mybatis/spring/mybatis-config.xml"));

SqlSessionFactory factory = factoryBean.getObject();

Expand Down Expand Up @@ -304,8 +304,7 @@ void testSpecifyConfigurationAndConfigLocation() throws Exception {
setupFactoryBean();

factoryBean.setConfiguration(new Configuration());
factoryBean
.setConfigLocation(new org.springframework.core.io.ClassPathResource("org/mybatis/spring/mybatis-config.xml"));
factoryBean.setConfigLocation(new ClassPathResource("org/mybatis/spring/mybatis-config.xml"));

Throwable e = assertThrows(IllegalStateException.class, factoryBean::getObject);
assertThat(e.getMessage())
Expand Down Expand Up @@ -344,7 +343,7 @@ void testEmptyMapperLocations() throws Exception {
@Test
void testMapperLocationsWithNullEntry() throws Exception {
setupFactoryBean();
factoryBean.setMapperLocations(new org.springframework.core.io.Resource[] { null });
factoryBean.setMapperLocations(new Resource[] { null });

assertDefaultConfig(factoryBean.getObject());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2022 the original author or authors.
* Copyright 2010-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,7 @@

@ExtendWith(SpringExtension.class)
@WebAppConfiguration
@SpringJUnitConfig(locations = "file:src/test/java/org/mybatis/spring/submitted/webapp_placeholder/spring.xml")
@SpringJUnitConfig(locations = "classpath:org/mybatis/spring/submitted/webapp_placeholder/spring.xml")
class WebappPlaceholderTest {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010-2022 the original author or authors.
Copyright 2010-2024 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010-2023 the original author or authors.
Copyright 2010-2024 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010-2023 the original author or authors.
Copyright 2010-2024 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2010-2023 the original author or authors.
# Copyright 2010-2024 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2010-2023 the original author or authors.
# Copyright 2010-2024 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2010-2022 the original author or authors.
# Copyright 2010-2024 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010-2022 the original author or authors.
Copyright 2010-2024 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright 2010-2022 the original author or authors.
Copyright 2010-2024 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright 2010-2022 the original author or authors.
-- Copyright 2010-2024 the original author or authors.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright 2010-2022 the original author or authors.
-- Copyright 2010-2024 the original author or authors.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010-2022 the original author or authors.
Copyright 2010-2024 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010-2022 the original author or authors.
Copyright 2010-2024 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2010-2022 the original author or authors.
# Copyright 2010-2024 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010-2022 the original author or authors.
Copyright 2010-2024 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010-2022 the original author or authors.
Copyright 2010-2024 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2010-2022 the original author or authors.
# Copyright 2010-2024 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010-2022 the original author or authors.
Copyright 2010-2024 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010-2022 the original author or authors.
Copyright 2010-2024 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010-2022 the original author or authors.
Copyright 2010-2024 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010-2022 the original author or authors.
Copyright 2010-2024 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit c0d7cc1

Please sign in to comment.