Skip to content

Commit

Permalink
fix: circular dependency problems
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasLohoff committed Sep 4, 2023
1 parent 51547ab commit d65b7ef
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 14 deletions.
6 changes: 4 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@
<spring-boot.version>3.1.3</spring-boot.version>
<spring-data.version>3.1.3</spring-data.version>

<!-- Mail -->
<jakarta-mail.version>2.0.1</jakarta-mail.version>

<!-- Hibernate -->
<hibernate.version>6.2.7.Final</hibernate.version>

Expand Down Expand Up @@ -562,8 +565,7 @@
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>jakarta.mail</artifactId>
<!-- <version>${jakarta-mail.version}</version>-->
<version>2.0.1</version>
<version>${jakarta-mail.version}</version>
</dependency>

<dependency>
Expand Down
2 changes: 0 additions & 2 deletions shogun-boot/src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ shogun:
srid: 25832

spring:
main:
allow-circular-references: true
flyway:
schemas: shogun, public
defaultSchema: shogun
Expand Down
1 change: 0 additions & 1 deletion shogun-config/src/main/resources/application-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ server:
spring:
main:
banner-mode: off
allow-circular-references: true
jpa:
# Show SQL statements
show-sql: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import de.terrestris.shogun.lib.annotation.JsonSuperType;
import io.hypersistence.utils.hibernate.type.util.ObjectMapperSupplier;
import jakarta.annotation.PostConstruct;
import lombok.extern.log4j.Log4j2;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.PrecisionModel;
Expand All @@ -51,6 +50,7 @@ public class JacksonConfig implements ObjectMapperSupplier {
public ObjectMapper objectMapper() {
if (mapper == null) {
mapper = new ObjectMapper();
init(mapper);
}
return mapper;
}
Expand All @@ -65,12 +65,9 @@ public ObjectMapper objectMapper() {
public ObjectMapper get() {
return objectMapper();
}

@PostConstruct
public void init() {
public void init(ObjectMapper objectMapper) {
if (!initialized) {
GeometryFactory geomFactory = new GeometryFactory(new PrecisionModel(coordinatePrecisionScale), srid);
ObjectMapper objectMapper = get();
objectMapper.registerModule(new JtsModule(geomFactory));

var javaTimeModule = new JavaTimeModule();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import de.terrestris.shogun.lib.service.BaseService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.history.Revision;
import org.springframework.data.history.Revisions;

Expand All @@ -38,6 +39,7 @@
public abstract class BaseGraphQLController<E extends BaseEntity, S extends BaseService<? extends BaseCrudRepository<E, Long>, E>> {

@Autowired
@Lazy
protected ObjectMapper objectMapper;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public abstract class BaseService<T extends BaseCrudRepository<S, Long> & JpaSpe
protected T repository;

@Autowired
@Lazy
ObjectMapper objectMapper;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@
package de.terrestris.shogun.lib.service;

import de.terrestris.shogun.lib.dto.WebSocketMessage;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service;

@Data
@Slf4j
@Service
public class WebSocketService {
private final SimpMessagingTemplate simpMessagingTemplate;
Expand Down

0 comments on commit d65b7ef

Please sign in to comment.