|
7 | 7 |
|
8 | 8 | import static java.util.Collections.singletonList; |
9 | 9 | import static java.util.Objects.requireNonNull; |
10 | | -import static java.util.stream.StreamSupport.stream; |
11 | 10 |
|
12 | 11 | import java.io.IOException; |
13 | 12 | import java.lang.reflect.Constructor; |
|
26 | 25 | import java.util.Objects; |
27 | 26 | import java.util.Optional; |
28 | 27 | import java.util.Properties; |
29 | | -import java.util.ServiceConfigurationError; |
30 | | -import java.util.ServiceLoader; |
31 | 28 | import java.util.Set; |
32 | 29 | import java.util.concurrent.Executor; |
33 | 30 | import java.util.concurrent.ExecutorService; |
|
54 | 51 | import io.jooby.output.BufferedOutputFactory; |
55 | 52 | import io.jooby.problem.ProblemDetailsHandler; |
56 | 53 | import io.jooby.value.ValueFactory; |
57 | | -import jakarta.inject.Provider; |
58 | 54 |
|
59 | 55 | /** |
60 | 56 | * Welcome to Jooby! |
@@ -520,49 +516,6 @@ public Jooby mvc(@NonNull MvcExtension router) { |
520 | 516 | } |
521 | 517 | } |
522 | 518 |
|
523 | | - @NonNull @Override |
524 | | - @Deprecated(since = "3.8.0", forRemoval = true) |
525 | | - public Jooby mvc(@NonNull Object router) { |
526 | | - Provider provider = () -> router; |
527 | | - return mvc(router.getClass(), provider); |
528 | | - } |
529 | | - |
530 | | - @NonNull @Override |
531 | | - @Deprecated(since = "3.8.0", forRemoval = true) |
532 | | - public Jooby mvc(@NonNull Class router) { |
533 | | - return mvc(router, () -> require(router)); |
534 | | - } |
535 | | - |
536 | | - @NonNull @Override |
537 | | - @Deprecated(since = "3.8.0", forRemoval = true) |
538 | | - public <T> Jooby mvc(@NonNull Class<T> router, @NonNull Provider<T> provider) { |
539 | | - try { |
540 | | - MvcFactory module = loadModule(router); |
541 | | - Extension extension = module.create(provider::get); |
542 | | - extension.install(this); |
543 | | - return this; |
544 | | - } catch (Exception x) { |
545 | | - throw SneakyThrows.propagate(x); |
546 | | - } |
547 | | - } |
548 | | - |
549 | | - @Deprecated(since = "3.8.0", forRemoval = true) |
550 | | - private <T> MvcFactory<T> loadModule(Class<T> router) { |
551 | | - try { |
552 | | - ServiceLoader<MvcFactory> modules = ServiceLoader.load(MvcFactory.class); |
553 | | - return stream(modules.spliterator(), false) |
554 | | - .filter(it -> it.supports(router)) |
555 | | - .findFirst() |
556 | | - .orElseGet( |
557 | | - () -> |
558 | | - /* Make happy IDE incremental build: */ |
559 | | - mvcReflectionFallback(router, getClassLoader())); |
560 | | - } catch (ServiceConfigurationError notfound) { |
561 | | - /* Make happy IDE incremental build: */ |
562 | | - return mvcReflectionFallback(router, getClassLoader()); |
563 | | - } |
564 | | - } |
565 | | - |
566 | 519 | @NonNull @Override |
567 | 520 | public Route ws(@NonNull String pattern, @NonNull WebSocket.Initializer handler) { |
568 | 521 | return router.ws(pattern, handler); |
@@ -1452,29 +1405,6 @@ private void joobyRunHook(ClassLoader loader, Server server) { |
1452 | 1405 | } |
1453 | 1406 | } |
1454 | 1407 |
|
1455 | | - /** |
1456 | | - * This method exists to integrate IDE incremental build with MVC annotation processor. It |
1457 | | - * fallback to reflection to lookup for a generated mvc factory. |
1458 | | - * |
1459 | | - * @param source Controller class. |
1460 | | - * @param classLoader Class loader. |
1461 | | - * @return Mvc factory. |
1462 | | - */ |
1463 | | - private MvcFactory mvcReflectionFallback(Class source, ClassLoader classLoader) { |
1464 | | - try { |
1465 | | - var moduleName = |
1466 | | - System.getProperty("jooby.routerPrefix", "") |
1467 | | - + source.getName() |
1468 | | - + System.getProperty("jooby.routerSuffix", "_"); |
1469 | | - Class<?> moduleType = classLoader.loadClass(moduleName); |
1470 | | - Constructor<?> constructor = moduleType.getDeclaredConstructor(); |
1471 | | - getLog().debug("Loading mvc using reflection: " + source); |
1472 | | - return (MvcFactory) constructor.newInstance(); |
1473 | | - } catch (Exception x) { |
1474 | | - throw Usage.mvcRouterNotFound(source); |
1475 | | - } |
1476 | | - } |
1477 | | - |
1478 | 1408 | /** |
1479 | 1409 | * Copy internal state from one application into other. |
1480 | 1410 | * |
|
0 commit comments