riku__02
@riku__02

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

Springbootでのセキュリティ関連実装での質問

解決したいこと

ここに解決したい内容を記載してください。
Spring解体新書という書籍で11章:Springセキュリティといった内容を実施中です。
直リンク禁止にするための最初の実装段階でpom.xmlに以下のコードを追加したところ、エラーが表示(赤波線)されるようになりました。
⇒プロジェクト・ビルド・エラー: 'dependencies.dependency.version' for org.thymeleaf.extras:thymeleaf-extras-springsecurity5:jar is missing.

バージョンの指定ではないかと想定していますが、どこのバージョンをどのバージョンに変更すべきか、理解出来ていないのでアドバイスよろしくお願いします。

追加した箇所
image.png

発生している問題・エラー

■pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>3.3.4</version>
		<relativePath /> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.example</groupId>
	<artifactId>SpringBootSample_1</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>SpringBootSample_1</name>
	<description>Demo project for Spring Boot</description>
	<url />
	<licenses>
		<license />
	</licenses>
	<developers>
		<developer />
	</developers>
	<scm>
		<connection />
		<developerConnection />
		<tag />
		<url />
	</scm>
	<properties>
		<java.version>21</java.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jdbc</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-jdbc</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-thymeleaf</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<scope>runtime</scope>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<!--jquery-->
		<dependency>
			<groupId>org.webjars</groupId>
			<artifactId>jquery</artifactId>
			<version>3.5.1</version>
		</dependency>
		<!--bootstrap-->
		<dependency>
			<groupId>org.webjars</groupId>
			<artifactId>bootstrap</artifactId>
			<version>4.5.3</version>
		</dependency>
		<!--webjars-locator-->
		<dependency>
			<groupId>org.webjars</groupId>
			<artifactId>webjars-locator</artifactId>
			<version>0.40</version>
		</dependency>
		<!--validator-->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-validation</artifactId>
		</dependency>
		<!--thymeleaf-layout-dialect-->
		<dependency>
			<groupId>nz.net.ultraq.thymeleaf</groupId>
			<artifactId>thymeleaf-layout-dialect</artifactId>
		</dependency>
		<!--MyBatis-->
		<dependency>
			<groupId>org.mybatis.spring.boot</groupId>
			<artifactId>mybatis-spring-boot-starter</artifactId>
			<version>3.0.3</version>
		</dependency>
		<!--Model Mapper-->
		<dependency>
			<groupId>org.modelmapper.extensions</groupId>
			<artifactId>modelmapper-spring</artifactId>
			<version>2.3.9</version>
		</dependency>
	    <!-- Spring AOP-->
	    <dependency>
	    <groupId>org.springframework</groupId>
	    <artifactId>spring-aop</artifactId>
	    </dependency>
	    <!--AspectJ -->
	    <dependency>
	     <groupId>org.aspectj</groupId>
	    <artifactId>aspectjweaver</artifactId>
	    </dependency>
	    <!-- SpringSecurity -->
		<dependency>
		    <groupId>org.springframework.boot</groupId>
		    <artifactId>spring-boot-starter-security</artifactId>
		</dependency>
		<!-- Thyemeleaf拡張ライブラリセキュリティ -->
		<dependency>
		    <groupId>org.thymeleaf.extras</groupId>
		    <artifactId>thymeleaf-extras-springsecurity</artifactId>
		</dependency>
  </dependencies>



	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<excludes>
						<exclude>
							<groupId>org.projectlombok</groupId>
							<artifactId>lombok</artifactId>
						</exclude>
					</excludes>
				</configuration>
			</plugin>
		</plugins>
	</build>

</project>

自分で試したこと

(versionを5⇒4,3に変更してみましたが、赤波線消えず。)

0

3Answer

Comments

  1. @riku__02

    Questioner

    @h_kono0707さん
    朝からアドバイスありがとうございます!
    バージョンを指定しましたが、赤線は消えない状態でした。
    他に何か原因は考えられますでしょうか、、?

    image.png

  2. 'dependencies.dependency.version' for org.thymeleaf.extras:thymeleaf-extras-springsecurity5:jar is missing.のエラーメッセージに変化はないでしょうか?

@h_kono0707さん
出社してしまったため帰宅後確認いたします。
申し訳ございませんが、再度夜ご確認よろしくお願いします:bow:

0Like
 		<!-- Thyemeleaf拡張ライブラリ(セキュリティ) -->
		<dependency>
		    <groupId>org.thymeleaf.extras</groupId>
		    <artifactId>thymeleaf-extras-springsecurity</artifactId>
		</dependency>

全角文字(日本語)と全角カッコ()が入っているのが気になります。
コメント文<!-- Thyemeleaf拡張ライブラリ(セキュリティ) -->を削除すると解決するでしょうか?

0Like

Your answer might help someone💌