<commit_before>package org.minimalj.frontend.impl.vaadin;

import org.minimalj.application.Application;
import org.minimalj.frontend.Frontend;
import org.minimalj.frontend.impl.vaadin.toolkit.VaadinFrontend;
import org.minimalj.frontend.impl.web.WebApplication;
import org.minimalj.util.StringUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;

import com.vaadin.flow.spring.RootMappedCondition;

@SpringBootApplication
public class Vaadin extends SpringBootServletInitializer {

    @Bean(name = "WebApplicationServletRegistration")
    public ServletRegistrationBean<MjWebApplicationServlet> servletRegistrationBean() {
        ServletRegistrationBean<MjWebApplicationServlet> registration = new ServletRegistrationBean<>(
                new MjWebApplicationServlet(), "/*");
        return registration;
    }
	
	private static void start(String... args) {
		Frontend.setInstance(new VaadinFrontend());

		String mjHandlerPath = WebApplication.mjHandlerPath();
		if (!StringUtils.isEmpty(mjHandlerPath) && mjHandlerPath.startsWith("/")) {
			if (!mjHandlerPath.isEmpty()) {
				mjHandlerPath += "*";
				System.setProperty(RootMappedCondition.URL_MAPPING_PROPERTY, mjHandlerPath);
			}
		}

		SpringApplication.run(Vaadin.class, args);
	}
	
	public static void start(Application application) {
		Application.setInstance(application);
		start();
	}
	
	public static void main(String... args) {<commit_msg>Vaadin start WebApplication under condition<commit_after>package org.minimalj.frontend.impl.vaadin;

import org.minimalj.application.Application;
import org.minimalj.frontend.Frontend;
import org.minimalj.frontend.impl.vaadin.toolkit.VaadinFrontend;
import org.minimalj.frontend.impl.web.WebApplication;
import org.minimalj.util.StringUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
import org.springframework.core.type.AnnotatedTypeMetadata;

import com.vaadin.flow.spring.RootMappedCondition;

@SpringBootApplication
public class Vaadin extends SpringBootServletInitializer {

    @Bean(name = "WebApplicationServletRegistration")
    @Conditional(IsWebApplication.class)
    public ServletRegistrationBean<MjWebApplicationServlet> servletRegistrationBean() {
        return new ServletRegistrationBean<>(new MjWebApplicationServlet(), "/*");
    }
	
    public static class IsWebApplication implements Condition {

		@Override
		public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
			return Application.getInstance() instanceof WebApplication;
		}
    }
    
	private static void start(String... args) {
		Frontend.setInstance(new VaadinFrontend());

		String mjHandlerPath = WebApplication.mjHandlerPath();
		if (!StringUtils.isEmpty(mjHandlerPath) && mjHandlerPath.startsWith("/")) {
			if (!mjHandlerPath.isEmpty()) {
				mjHandlerPath += "*";
				System.setProperty(RootMappedCondition.URL_MAPPING_PROPERTY, mjHandlerPath);
			}
		}

		SpringApplication.run(Vaadin.class, args);
	}
	
	public static void start(Application application) {
		Application.setInstance(application);
		start();
	}
	
	public static void main(String... args) {
{'fraction_non_alphanumeric': 0.09837781266352695, 'fraction_numerical': 0.0, 'mean_word_length': 5.938294010889292, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5137122', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1016, 'n_words': 176}