forked from springpython/springpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
32 lines (21 loc) · 668 Bytes
/
main.py
File metadata and controls
32 lines (21 loc) · 668 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pdb
from src.springpython.config import PythonConfig, Object
from src.springpython.context import ApplicationContext
class WikiService(object):
"""
serves wiki
"""
def __init__(self):
self.data = "wiki service"
def get_name(self):
return "test service"
class WikiProductAppConfig(PythonConfig):
def __init__(self):
super(WikiProductAppConfig, self).__init__()
@Object
def wiki_service(self):
return WikiService()
if __name__ == "__main__":
ctx = ApplicationContext(WikiProductAppConfig())
service = ctx.get_object("wiki_service")
assert service.get_name() == "test service"