-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
29 additions
and
26 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
|
@@ -21,9 +21,6 @@ | |
import com.jfinal.core.ControllerFactory; | ||
import io.jboot.Jboot; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author Michael Yang 杨福海 ([email protected]) | ||
* @version V1.0 | ||
|
@@ -40,20 +37,24 @@ public static JbootControllerManager me() { | |
private JbootControllerManager() { | ||
} | ||
|
||
private ThreadLocal<Map<Class<? extends Controller>, Controller>> buffers = new ThreadLocal<Map<Class<? extends Controller>, Controller>>() { | ||
protected Map<Class<? extends Controller>, Controller> initialValue() { | ||
return new HashMap<Class<? extends Controller>, Controller>(); | ||
} | ||
}; | ||
// private ThreadLocal<Map<Class<? extends Controller>, Controller>> buffers = new ThreadLocal<Map<Class<? extends Controller>, Controller>>() { | ||
// protected Map<Class<? extends Controller>, Controller> initialValue() { | ||
// return new HashMap<Class<? extends Controller>, Controller>(); | ||
// } | ||
// }; | ||
// | ||
// public Controller getController(Class<? extends Controller> controllerClass) throws InstantiationException, IllegalAccessException { | ||
// Controller ret = buffers.get().get(controllerClass); | ||
// if (ret == null) { | ||
// ret = controllerClass.newInstance(); | ||
// Jboot.injectMembers(ret); | ||
// buffers.get().put(controllerClass, ret); | ||
// } | ||
// return ret; | ||
// } | ||
|
||
public Controller getController(Class<? extends Controller> controllerClass) throws InstantiationException, IllegalAccessException { | ||
Controller ret = buffers.get().get(controllerClass); | ||
if (ret == null) { | ||
ret = controllerClass.newInstance(); | ||
Jboot.injectMembers(ret); | ||
buffers.get().put(controllerClass, ret); | ||
} | ||
return ret; | ||
return Jboot.bean(controllerClass); | ||
} | ||
|
||
|
||
|