tm1-spring-boot-starter 0.1.1 API
tm1.* properties.
Getting started
Have a TM1 server to talk to. To run one on your own computer in Docker, follow Run TM1 on your own computer. You need your own licensed copy of TM1 Server.
Add the starter to a Spring Boot 4 application. Gradle:
implementation("io.skipcheck:tm1-spring-boot-starter:0.1.1")Maven:
<dependency> <groupId>io.skipcheck</groupId> <artifactId>tm1-spring-boot-starter</artifactId> <version>0.1.1</version> </dependency>Tell it where TM1 is. The starter connects with the
tm1settings inapplication.yml; these are the defaults of a server set up with the link above:# src/main/resources/application.yml tm1: # Where TM1 is: the server's address, as for tm1-server on this computer address: http://localhost:8010 # Who to log in as: tm1-server's default admin, with no password user: admin password: "" # With Cognos (CAM) security, also name the CAM namespace: # namespace: LDAPFor a server elsewhere, change the address. Keep a real password out of the file, for example with
password: ${TM1_PASSWORD}and an environment variable.Tm1Propertieslists every property.Say hello. The starter builds a
Tm1Clientfrom those settings; ask for it, and use it. This prints the server's version and lists its cubes when the application starts:import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import io.skipcheck.tm1.client.Tm1Client; import io.skipcheck.tm1.client.model.Cube; import io.skipcheck.tm1.client.odata.ODataQuery; @SpringBootApplication public class HelloTm1Application { public static void main(String[] args) { SpringApplication.run(HelloTm1Application.class, args); } // The starter built the client from the tm1 settings: just ask for it @Bean ApplicationRunner hello(Tm1Client tm1) { return args -> tm1.session() .version() .doOnNext(version -> System.out.println("Hello from TM1 " + version)) .thenMany(tm1.cubes().modelCubes(ODataQuery.none().select(Cube.NAME))) .doOnNext(cube -> System.out.println(" " + cube.name())) .then() .block(); // fine at startup; in a web request, return the Flux instead } }Run it with
./gradlew bootRun(ormvn spring-boot:run):Hello from TM1 11.8.03500.6 Plan_BudgetPlan SalesCube ...
Where next
Tm1AutoConfiguration: the beans it creates, and a session per user from the pool.Tm1ConnectionDetails: logging in your own way, such as with CAM.Tm1ServersProperties: several servers, each under a name of your choosing, with a client you inject by that name.- tm1-spring-boot-testcontainers: a real TM1 in your Spring Boot tests.
tm1.servers.<name>.* or, for the server named default, tm1.*,
Tm1ConnectionDetails (so
@ServiceConnection can supply the connection) and beans for the session, the
client and, when enabled, the session pool.