Skip to content

Commit 6094e2a

Browse files
authored
Add initialize example
📝 add the initialize example to allow developer use the library
1 parent 8dd7a9e commit 6094e2a

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,47 @@ First, add the SF Java UI library to your java web project:
4848
Add the oss repository:
4949
```xml
5050
The official version Not yet deployed
51+
```
52+
#### Using spring boot
53+
54+
If you a are using spring boot to develop your project, you can add the annotation below to your main spring boot class in order to run the servlet context loader to inialize the library
55+
56+
```Java
57+
58+
@ServletComponentScan(basePackages = { "io.asfjava.ui.core" })
59+
60+
```
61+
You can follow the example below used in the demo application
62+
63+
```Java
64+
import org.springframework.boot.SpringApplication;
65+
import org.springframework.boot.autoconfigure.SpringBootApplication;
66+
import org.springframework.boot.web.servlet.ServletComponentScan;
67+
68+
@SpringBootApplication
69+
/*
70+
* The annotation below used to scan the servlet context loader added to the sf-java-ui library
71+
* in order to initialize the library @ server startup
72+
*
73+
* */
74+
@ServletComponentScan(basePackages = { "io.asfjava.ui.core" })
75+
public class DemoApplication {
76+
public static void main(String[] args) {
77+
SpringApplication.run(DemoApplication.class, args);
78+
}
79+
}
80+
81+
82+
```
83+
84+
#### Using other java web project
85+
86+
You can add this line of code on your custom startup listener.
87+
88+
```Java
89+
90+
SFJavaUi.initialize();
91+
5192
```
5293

5394
Create a new Rest Web Service. (example using spring)

0 commit comments

Comments
 (0)