Last active
October 19, 2023 01:24
-
-
Save ar/86a4a24384d029c35f784079007393b0 to your computer and use it in GitHub Desktop.
Q2Boot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* jPOS Project [http://jpos.org] | |
* Copyright (C) 2000-2022 jPOS Software SRL | |
* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU Affero General Public License as | |
* published by the Free Software Foundation, either version 3 of the | |
* License, or (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
* GNU Affero General Public License for more details. | |
* | |
* You should have received a copy of the GNU Affero General Public License | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |
*/ | |
package org.jpos.q2.springboot; | |
import org.jpos.q2.Q2; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.ApplicationArguments; | |
import org.springframework.stereotype.Component; | |
import javax.annotation.PostConstruct; | |
import javax.annotation.PreDestroy; | |
@Component | |
public class Q2Boot { | |
private Q2 q2; | |
@Autowired | |
private ApplicationArguments args; | |
@PostConstruct | |
public void init () { | |
q2 = new Q2(args.getSourceArgs()); | |
q2.start(); | |
} | |
@PreDestroy | |
public void destroy () { | |
if (q2 != null) | |
q2.shutdown(true); | |
q2 = null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment