001package ball.spring.mysqld;
002/*-
003 * ##########################################################################
004 * Reusable Spring Components
005 * %%
006 * Copyright (C) 2018 - 2022 Allen D. Ball
007 * %%
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *      http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 * ##########################################################################
020 */
021import lombok.ToString;
022import lombok.extern.log4j.Log4j2;
023import org.springframework.beans.factory.annotation.Autowired;
024import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
025import org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryDependsOnPostProcessor;
026import org.springframework.stereotype.Component;
027
028import static org.apache.commons.lang3.StringUtils.EMPTY;
029
030/**
031 * {@link EntityManagerFactoryDependsOnPostProcessor} {@link Component}
032 * implementation.  See
033 * {@link.uri https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto.data-access.configure-a-component-that-is-used-by-jpa target=newtab Configure a Component that is Used by JPA}.
034 *
035 * {@injected.fields}
036 *
037 * @author {@link.uri mailto:ball@hcf.dev Allen D. Ball}
038 */
039@Component
040@ConditionalOnProperty(name = "mysqld.home", havingValue = EMPTY)
041@ToString @Log4j2
042public class EntityManagerFactoryComponent extends EntityManagerFactoryDependsOnPostProcessor {
043    @Autowired private Process mysqld;
044
045    /**
046     * Sole constructor.
047     */
048    public EntityManagerFactoryComponent() { super("mysqld"); }
049}