Аудит в 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);
но ничего не проверяется

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

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

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

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

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

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

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