Как включить и настроить аудит в приложении Spring BootJAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Как включить и настроить аудит в приложении Spring Boot

Сообщение Anonymous »

У меня есть основной класс:

Код: Выделить всё

@SpringBootApplication
@EnableScheduling
@ConfigurationPropertiesScan
@EnableJpaAuditing(auditorAwareRef = "auditorAwareImpl")
public class PlanetsApplication {

public static void main(String[] args) {

SpringApplication.run(PlanetsApplication.class, args);

}
}
и

Код: Выделить всё

@Component("auditorAwareImpl")
public class AuditorAwareImpl implements AuditorAware {

@NotNull
@Override
public Optional getCurrentAuditor() {
return Optional.of("system");
}

}
и

Код: Выделить всё

@Getter
@Setter
@EntityListeners(AuditingEntityListener.class)
@MappedSuperclass
public class BaseEntity {

@CreatedDate
@Column(updatable = false)
protected LocalDateTime createdAt;

@CreatedBy
@Column(updatable = false)
private String createdBy;

@LastModifiedDate
@Column(updatable = false)
protected LocalDateTime updatedAt;

@LastModifiedBy
@Column(updatable = false)
protected String updatedBy;

}
и

Код: Выделить всё

@Entity
@Table(name = "t_spotify_playlist", uniqueConstraints =
@UniqueConstraint(columnNames = {"playlistId", "sun", "moon"}))
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class SpotifyPlayList extends BaseEntity implements Serializable {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String playlistId;
@Column(length = 50)
private String sun;
@Column(length = 50)
private String moon;

// Many-to-Many relationship with SpotifyTrack
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(
name = "t_playlist_track", // Join table name
joinColumns = @JoinColumn(name = "playlist_id"), // Foreign key for SpotifyPlayListDesc
inverseJoinColumns = @JoinColumn(name = "track_id") // Foreign key for SpotifyTrack
)
private Set tracks; // Tracks associated with the playlist

}
Я сохраняю объект:

Код: Выделить всё

SpotifyPlayList spotifyPlayList2 = spotifyPlayListService.findAll().stream().findAny().get();
spotifyPlayList2.setSun(spotifyPlayList2.getSun().toUpperCase());
spotifyPlayListService.save(spotifyPlayList2);

log.info("saved {} ", spotifyPlayList2);
но в БД ничего не проверяется
в журналах:

Код: Выделить всё

Hibernate:
update
t_spotify_playlist
set
moon=?,
playlist_id=?,
sun=?
where
id=?
тоже пробовал

Код: Выделить всё

@Getter
@Setter
@EntityListeners(AuditingEntityListener.class)
@MappedSuperclass
public class BaseEntity {

@CreatedDate
@Column
protected LocalDateTime createdAt;

@CreatedBy
@Column(updatable = false)
private String createdBy;

@LastModifiedDate
protected LocalDateTime updatedAt;

@LastModifiedBy
protected String updatedBy;

}
с тем же результатом

Подробнее здесь: https://stackoverflow.com/questions/793 ... pplication
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Как включить и настроить аудит в приложении Spring Boot
    Anonymous » » в форуме JAVA
    0 Ответы
    9 Просмотры
    Последнее сообщение Anonymous
  • Как включить и настроить аудит в приложении Spring Boot
    Anonymous » » в форуме JAVA
    0 Ответы
    7 Просмотры
    Последнее сообщение Anonymous
  • Как включить и настроить аудит в приложении Spring Boot
    Anonymous » » в форуме JAVA
    0 Ответы
    17 Просмотры
    Последнее сообщение Anonymous
  • Как включить и настроить аудит в приложении Spring Boot
    Гость » » в форуме JAVA
    0 Ответы
    16 Просмотры
    Последнее сообщение Гость
  • Аудит в Spring Boot
    Anonymous » » в форуме JAVA
    0 Ответы
    13 Просмотры
    Последнее сообщение Anonymous

Вернуться в «JAVA»